Text File Format
headerinfo = "abc"
**part1=001**
element1
element2....
...
element15
end_element
**part2=002**
element1
element2....
...
emelent15
end_element
......
end_header
I want to select all rows of text starting from part1=001 up to but not including part2=002.
So far I have:
var res = (from line in File.ReadAllLines(sExecPath + #"\" + sFileName)
where line == "part1=001"
select line).ToList();
I am trying to use between option in linq, it does not seem to return any result.
var part1= (from prt in File.ReadAllLines(sExecPath + #"\" + sFileName)
where prt.CompareTo("part1=001") >=0
&& prt.CompareTo("part=002") >= 0
select prt);
I think you are looking for TakeWhile:
var linesInPartOne = File
.ReadAllLines(sExecPath + #"\" + sFileName)
.SkipWhile(line => !line.StartsWith("**part1="))
// To skip to part 1 header line, uncomment the line below:
// Skip(1)
.TakeWhile(line => !line.StartsWith("**part2="));
To generalize this to retrieve any given numbered part, something like this would do:
public static IEnumerable<String> ReadHeaderPart(String filePath, int part) {
return File
.ReadAllLines(filePath)
.SkipWhile(line => !line.StartsWith("**part" + part + "="))
// To skip to part 1 header line, uncomment the line below:
// Skip(1)
.TakeWhile(line =>
!line.StartsWith("**part" + (part + 1) + "="
&&
!line.StartsWith("end_header")))
.ToList();
}
EDIT: I had a Skip(1) in there to skip the part 1 header. Removed it since you seem to want to keep that line.
public static IEnumerable<string> GetLinesBetween(
string path,
string fromInclusive,
string toExclusive)
{
return File.ReadLines(path)
.SkipWhile(line => line != fromInclusive)
.TakeWhile(line => line != toExclusive);
}
var path = Path.Combine(sExecPath, sFileName); // don't combine paths like that
var result = GetLinesBetween(path, "part1=001", "part2=002").ToList();
The simplest and streghtforward solution comes to me is something like this:
var lines = File.ReadAllLines(#"C:\Sample.txt").
SkipWhile(line=>!line.Contains("part1")).
Skip(1).TakeWhile(line=>!line.Contains("part2"));
It returns result you want actually.
The logic is simple:
SkipWhile lines till meeting a line that contains "part1"
after Skip(1) (as it will be actually that one that contains "part1" string)
finally Take those ones till getting to the line containing "part2".
Linq probably isn't your best bet here. Just try doing
var lines = File.ReadAllLines(filename);
List<string> linesICareABout = new List<string>();
for(int i = 0; !linesICareAbout[i].Contains("part2=002"); ++i)
{
linesICareABout.Add(lines[i]);
}
Then do whatever you want with the lines you read in.
However, if you're really dedicated to using Linq, try TakeWhile
http://msdn.microsoft.com/en-us/library/bb534804.aspx
Related
I have such code:
string[] list_lines = System.IO.File.ReadAllLines(#"F:\VS\WriteLines.xls");
System.Console.WriteLine("Contents of Your Database = ");
foreach (var line in list_lines.OrderBy(line => line.Split(';')[3]))
{
Console.WriteLine("\t" + line);
}
I would like to TryParse the list_lines so they are numbers, not strings.
Is it possible to 'bulk' it somehow?
Each line consists of 5 strings after they are Split.
EDIT
I wrote this:
string[] list_lines = System.IO.File.ReadAllLines(#"F:\VS\WriteLines.xls");
int[] newList;
// Display the file contents by using a foreach loop.
System.Console.WriteLine("Contents of Your Database = ");
int.TryParse(list_lines[], out newList);
foreach (var line in newList.OrderBy(line => line.Split(';')[3]))
{
// Use a tab to indent each line of the file.
Console.WriteLine("\t" + line);
}
But I get error on list_lines[] , it says that there must be a value.
Based on your previous question, it seems that you want to order the lines by the 3rd split result as int, then you can do this way :
foreach (var line in list_lines.OrderBy(line =>
{
int lineNo;
var success = int.TryParse(line.Split(';')[3], out lineNo);
if(success) return lineNo;
return int.MaxValue;
}))
{
Console.WriteLine("\t" + line);
}
I'm using int.MaxValue as default for when TryParse fails. This way, failed lines will come last. You can change the default to int.MinValue instead, if you want the failed lines to come first.
By the way, C# naming convention uses camel-case for variables, like lineNo and listLines instead of line_no and list_lines.
To get int[] that corresponds to each line, you can use similar logic, but now in a Select() method instead of OrderBy() :
int[] newList = list_lines.Select(line =>
{
int lineNo;
var success = int.TryParse(line.Split(';')[3], out lineNo);
if(success) return lineNo;
return int.MaxValue; //or whatever default value appropriate
})
.ToArray();
You can use SelectMany to flatten the list.
list_lines.SelectMany(line => line.Split(';')).Select(cell => int.Parse(cell));
If there can be non-number cells and you are looking for positive numbers you can add a Where clause
list_lines.SelectMany(line => line.Split(';')).Where(cell => cell.All(#char => char.IsDigit(#char))).Select(cell => int.Parse(cell));
One way of doing it:
int number;
var intList = list_lines.Select(s => s.Split(';')
.Where(p => Int32.TryParse(p, out number))
.Select(y => Int32.Parse(y)))
.SelectMany(d=>d).ToList();
I have a bunch of SKUs (stock keeping units) that represent a series of strings that I'd like to create a single Regex to match for.
So, for example, if I have SKUs:
var skus = new[] { "BATPAG003", "BATTWLP03", "BATTWLP04", "BATTWSP04", "SPIFATB01" };
...I'd like to automatically generate the Regex to recognize any one of the SKUs.
I know that I could do simply do "BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01", but list of SKUs can be quite lengthy and I'd like to compress the resulting Regex to look like "BAT(PAG003|TW(LP0(3|4)|SP04))|SPIFATB01"
So this is a combinatorics exercise. I want to generate the all of the possible Regex to match any of my input strings, with the view that the shortest is probably the best.
I could, for example, produce any of these:
BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01
BAT(PAG003|TW(LP0(3|4)|SP04))|SPIFATB01
BAT(PAG003|TW(LP(03|04)|SP04))|SPIFATB01
B(ATPAG003|ATTW(LP0(3|4)|ATSP04))|SPIFATB01
Any of those would work, but the shortest is probably the one I'd choose.
To start with I've tried to implement this function:
Func<IEnumerable<string>, IEnumerable<string>> regexify = null;
regexify = xs =>
from n in Enumerable.Range(1, 10)
let g = xs.ToArray().Where(s => !String.IsNullOrWhiteSpace(s)).GroupBy(x => new String(x.Take(n).ToArray()), x => new String(x.Skip(n).ToArray()))
let parts = g.SelectMany(x => x.Count() > 1 ? regexify(x).Select(y => x.Key + "(" + String.Join("|", y) + ")") : new [] { x.Key + String.Join("", x) })
let regex = String.Join("|", parts)
orderby regex.Length
select regex;
This takes my source skus and results in a list of possible Regex's, but it's not working. This is the current output:
BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01
BATPAG003|BATTWLP03|BATTWLP04|BATTWSP04|SPIFATB01
BATPAG003|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWLP0(3|4)|BATTWSP04|SPIFATB01
BATPAG003|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(03|04)|BATTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|BATTWSP04|SPIFATB01
BATPAG003|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P03|P04)|BATTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|BATTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|BATTWSP04|SPIFATB01
BATPAG003|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP03|LP04|SP04)|BATTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|BATTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|BATTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)|SPIFATB01
BATPAG003|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP03|WLP04|WSP04)|BATT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|BATT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|BATT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|BATT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|SPIFATB01
BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP03|TWLP04|TWSP04)|BAT(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|BAT(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|BAT(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|BAT(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|BAT(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|SPIFATB01
BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|BA(TPAG003|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWSP04)|BA(TPAG003|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TTWSP04)|BA(TPAG003|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TTWSP04)|BA(TPAG003|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|BA(TPAG003|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|TT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|TT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|TT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|BA(T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|T(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|T(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|T(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|T(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))))|SPIFATB01
B(ATPAG003|ATTWLP03|ATTWLP04|ATTWSP04)|B(ATPAG003|ATTWLP03|ATTWLP04|ATTWSP04)|B(ATPAG003|ATTWLP03|ATTWLP04|ATTWSP04)|B(ATPAG003|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWLP0(3|4)|ATTWSP04)|B(ATPAG003|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(03|04)|ATTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|ATTWSP04)|B(ATPAG003|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P03|P04)|ATTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|ATTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|ATTWSP04)|B(ATPAG003|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP03|LP04|SP04)|ATTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|ATTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|ATTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|B(ATPAG003|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP03|WLP04|WSP04)|ATT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|ATT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|ATT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|ATT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|B(AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP03|TWLP04|TWSP04)|AT(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|AT(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|AT(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|AT(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|AT(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))))|B(A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP03|TTWLP04|TTWSP04)|A(TPAG003|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWLP0(3|4)|TTWSP04)|A(TPAG003|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(03|04)|TTWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TTWSP04)|A(TPAG003|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P03|P04)|TTWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TTWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TTWSP04)|A(TPAG003|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP03|LP04|SP04)|TTW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TTW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TTW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|A(TPAG003|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP03|WLP04|WSP04)|TT(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|TT(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|TT(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|TT(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))|A(T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP03|TWLP04|TWSP04)|T(PAG003|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWLP0(3|4)|TWSP04)|T(PAG003|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(03|04)|TWLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|TWSP04)|T(PAG003|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P03|P04)|TWL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|TWL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|TWSP04)|T(PAG003|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP03|LP04|SP04)|TW(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|TW(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|TW(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04))|T(PAG003|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP03|WLP04|WSP04)|T(WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WLP0(3|4)|WSP04)|T(WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(03|04)|WLP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|WSP04)|T(WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P03|P04)|WL(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|WL(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|WSP04)|T(W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP03|LP04|SP04)|W(LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|LP0(3|4)|SP04)|W(LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(03|04)|LP(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4))|SP04)|W(L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P03|P04)|L(P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4)|P0(3|4))|L(P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(03|04)|P(0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)|0(3|4)))|SP04)))))|SPIFATB01
It feels very close, and I think I'm slightly doing something wrong.
This works if each SKU id have the same length.
// ...
string regexStr = Calculate(skus);
// ...
public static string Calculate(IEnumerable<string> rest) {
if (rest.First().Length > 0) {
string[] groups = rest.GroupBy(r => r[0])
.Select(g => g.Key + Calculate(g.Select(e => e.Substring(1))))
.ToArray();
return groups.Length > 1 ? "(" + string.Join("|", groups) + ")" : groups[0];
} else {
return string.Empty;
}
}
This is what I finally worked out:
var skus = new[] { "BATPAG003", "BATTWLP03", "BATTWLP04", "BATTWSP04", "SPIFATB01" };
Func<IEnumerable<IGrouping<string, string>>, IEnumerable<string>> regexify = null;
Func<IEnumerable<string>, IEnumerable<string>> generate =
xs =>
from n in Enumerable.Range(2, 20)
let g = xs.GroupBy(x => new String(x.Take(n).ToArray()), x => new String(x.Skip(n).ToArray()))
where g.Count() != xs.Count()
from r in regexify(g)
select r;
regexify = gxs =>
{
if (!gxs.Any())
{
return new [] { "" };
}
else
{
var rs = regexify(gxs.Skip(1)).ToArray();
return
from f in gxs.Take(1)
from z in new [] { String.Join("|", f) }.Concat(f.Count() > 1 ? generate(f) : Enumerable.Empty<string>())
from r in rs
select f.Key + (f.Count() == 1 ? z : $"({z})") + (r != "" ? "|" + r : "");
}
};
Then using this query:
generate(skus).OrderBy(x => x).OrderBy(x => x.Length);
...I got this result:
BAT(PAG003|TW(LP0(3|4)|SP04))|SPIFATB01
BAT(PAG003|TWLP0(3|4)|TWSP04)|SPIFATB01
BA(TPAG003|TTW(LP0(3|4)|SP04))|SPIFATB01
BAT(PAG003|TW(LP(03|04)|SP04))|SPIFATB01
BAT(PAG003|TW(LP03|LP04|SP04))|SPIFATB01
BAT(PAG003|TWLP(03|04)|TWSP04)|SPIFATB01
BATPAG003|BATTW(LP0(3|4)|SP04)|SPIFATB01
BA(TPAG003|TT(WLP0(3|4)|WSP04))|SPIFATB01
BA(TPAG003|TTW(LP(03|04)|SP04))|SPIFATB01
BA(TPAG003|TTW(LP03|LP04|SP04))|SPIFATB01
BA(TPAG003|TTWLP0(3|4)|TTWSP04)|SPIFATB01
BAT(PAG003|TWL(P0(3|4))|TWSP04)|SPIFATB01
BAT(PAG003|TWL(P03|P04)|TWSP04)|SPIFATB01
BATPAG003|BATT(WLP0(3|4)|WSP04)|SPIFATB01
BATPAG003|BATTW(LP(03|04)|SP04)|SPIFATB01
BATPAG003|BATTW(LP03|LP04|SP04)|SPIFATB01
BA(TPAG003|TT(WLP(03|04)|WSP04))|SPIFATB01
BA(TPAG003|TTWLP(03|04)|TTWSP04)|SPIFATB01
BAT(PAG003|TWLP03|TWLP04|TWSP04)|SPIFATB01
BATPAG003|BATT(WLP(03|04)|WSP04)|SPIFATB01
BA(TPAG003|TT(WL(P0(3|4))|WSP04))|SPIFATB01
BA(TPAG003|TT(WL(P03|P04)|WSP04))|SPIFATB01
BA(TPAG003|TT(WLP03|WLP04|WSP04))|SPIFATB01
BA(TPAG003|TTWL(P0(3|4))|TTWSP04)|SPIFATB01
BA(TPAG003|TTWL(P03|P04)|TTWSP04)|SPIFATB01
BATPAG003|BATT(WL(P0(3|4))|WSP04)|SPIFATB01
BATPAG003|BATT(WL(P03|P04)|WSP04)|SPIFATB01
BATPAG003|BATT(WLP03|WLP04|WSP04)|SPIFATB01
BATPAG003|BATTWLP0(3|4)|BATTWSP04|SPIFATB01
BATPAG003|BATTWLP(03|04)|BATTWSP04|SPIFATB01
BA(TPAG003|TTWLP03|TTWLP04|TTWSP04)|SPIFATB01
BATPAG003|BATTWL(P0(3|4))|BATTWSP04|SPIFATB01
BATPAG003|BATTWL(P03|P04)|BATTWSP04|SPIFATB01
The only problem with my approach was computation time. Some of my source lists have nearly 100 SKUs. Some of the runs were taking longer than I care to wait for and had to break it down into smaller chunks and then manually concatenate.
Take the entire list of all of your sku's and make a single ternary tree regex.
When you add or delete sku's, regenerate the regex. Maybe your database
generates on a weekly basis.
This utility makes a regex of 10,000 strings in less than half a second
and size is not important, it could be 300,000 strings.
For example, here is regex of 175,000 word dictionary.
My program creates a .csv file with a persons name and an integer next to them.
Occasionally there are two entries of the same name in the file, but with a different time. I only want one instance of each person.
I would like to take the mean of the two numbers to produce just one row for the name, where the number will be the average of the two existing.
So here Alex Pitt has two numbers. How can I take the mean of 105 and 71 (in this case) to produce a row that just includes Alex Pitt, 88?
Here is how I am creating my CSV file if reference is required.
public void CreateCsvFile()
{
PaceCalculator ListGather = new PaceCalculator();
List<string> NList = ListGather.NameGain();
List<int> PList = ListGather.PaceGain();
List<string> nAndPList = NList.Zip(PList, (a, b) => a + ", " + b).ToList();
string filepath = #"F:\A2 Computing\C# Programming Project\ScheduleFile.csv";
using (var file = File.CreateText(filepath))
{
foreach (var arr in nAndPList)
{
if (arr == null || arr.Length == 0) continue;
file.Write(arr[0]);
for (int i = 1; i < arr.Length; i++)
{
file.Write(arr[i]);
}
file.WriteLine();
}
}
}
To start with, you can write your current CreateCsvFile much more simply like this:
public void CreateCsvFile()
{
var filepath = #"F:\A2 Computing\C# Programming Project\ScheduleFile.csv";
var ListGather = new PaceCalculator();
var records =
ListGather.NameGain()
.Zip(ListGather.PaceGain(),
(a, b) => String.Format("{0},{1}", a, b));
File.WriteAllLines(filepath, records);
}
Now, it can easily be changed to work out the average pace if you have duplicate names, like this:
public void CreateCsvFile()
{
var filepath = #"F:\A2 Computing\C# Programming Project\ScheduleFile.csv";
var ListGather = new PaceCalculator();
var records =
from record in ListGather.NameGain()
.Zip(ListGather.PaceGain(),
(a, b) => new { Name = a, Pace = b })
group record.Pace by record.Name into grs
select String.Format("{0},{1}", grs.Key, grs.Average());
File.WriteAllLines(filepath, records);
}
I would recommend to merge the duplicates before you put everything into the CSV file.
use:
// The List with all duplicate values
List<string> duplicateChecker = new List<string>();
//Takes the duplicates and puts them in a new List. I'm using the NList because I assume the Names are the important part.
duplicateChecker = NList .Distinct().ToList();
Now you can simply Iterrate through the new list and search their values in your NList. Use a foreach loop which is looking up the index of the Name value in Nlist. After that you can use the Index to merge the integers with a simple math method.
//Something like this:
Make a foreach loop for every entry in your duplicateChecker =>
Use Distrinc again on duplicateChecker to make sure you won't go twice through the same duplicate =>
Get the Value of the current String and search it in Nlist =>
Get the Index of the current Element in Nlist and search for the Index in Plist =>
Get the Integer of Plist and store it in a array =>
// make sure your math method runs before a new name starts. After that store the new values in your nAndPList
Once the Loop is through with the first name use a math method.
I hope you understand what I was trying to say. However I would recommend using a unique identifier for your persons. Sooner or later 2 persons will appear with the same name (like in a huge company).
Change the code below:
List<string> nAndPList = NList.Zip(PList, (a, b) => a + ", " + b).ToList();
To
List<string> nAndPList = NList.Zip(PList, (a, b) => a + ", " + b)
.ToList()
.GroupBy(x => x.[The field you want to group by])
.Select(y => y.First);
I have some C# code in a string that looks like this:
content = 'var expData =
details.Select(x => x.Explanation.TextWithHtml).ToList();
var score = resData.SequenceEqual(ansData);
var explanation = "";';
How can I make it so the code is converted to the following using LINQ?
<td>01</td><td>var expData =
details.Select(x => x.Explanation.TextWithHtml ).ToList();</td>
<td>02</td><td>var score = resData.SequenceEqual(ansData);</td>
<td>03</td><td>var explanation = "";</td>
It sounds like you want something like:
var lines = text.Split(new[] { "\r\n" }, StringSplitOptions.None)
.Select((line, index) =>
string.Format("<td>{0:00}</td><td>{1}</td>",
index + 1, EscapeHtml(line)));
You'd need to write EscapeHtml though - you don't want tags in your C# code to still end up as tags in the HTML!
This should work, you can get the index from Enumerable.Select:
IEnumerable<String> code =
content.Split(new[] { Environment.NewLine }, StringSplitOptions.None)
.Select((line, index) =>
string.Format("<td>{0}</td><td>{1}</td>",
(index + 1).ToString("D2"), line));
How to: Pad a Number with Leading Zeros
Imagine that a user entered a sentence and I need to search for the subjects that consist of words within the entered sentence. These are the code that I thought they could solve the case.
var result = from x in dataBase.tableName
select x;
string[] words = enteredString.Split();
foreach(string word in words)
{
result = result.Where(x => x.subject.Contains(word));
}
it shows only the search result with the last word in sentence, but I thought the result must be narrowed down each time a word is used in the where line.
Try this:
foreach(string word in words)
{
var temp = word;
result = result.Where(x => x.subject.Contains(temp));
}
This is called (by ReSharper at least) "access to modified closure" - lambda expressions don't capture the value, they capture the entire variable. And the value of the variable word is changing with each iteration of the loop. So, since the Where() method is lazy-evaluated, by the time this sequence is consumed, the value of word is the last one in the sequence.
I hade some success by inverting the logic like this:
string[] words = enteredString.Split();
var results = from x in database.TableName
where words.Any(w => x.subject.Contains(w))
select x;
-- Edit
A more generic approach, for this kind of queries, would be:
class SearchQuery
{
public ICollection<string> Include { get; private set; }
public ICollection<string> Exclude { get; private set; }
}
[...]
SearchQuery query = new SearchQuery
{
Include = { "Foo" }, Exclude = { "Bar" }
}
var results = from x in database.Table
where query.Include.All(i => x.Subject.Contains(i)) &&
query.Exclude.All(i => !x.Subject.Contains(i))
select x;
This assumes that all words in query.Include must occur in Subject, if you want to find any subjects that have at least one of the words query.Include.All should be query.Include.Any
I've tested this with Entity Framework 4. Which will create a SQL query that applies all criteria in the database rather than in memory.
Here you go:
var result = from x in dataBase.tableName
select x;
string[] words = enteredString.Split();
result.Where(r => words.Any(w => r.Subject.Contains(w));
it can't do the thing - since with every word you are overwriting the previous result - you need to do something similar to:
List<object> AllResults = new List<object>();
foreach(string word in words)
{
var temp = word;
AllResults.AddRange (result.Where(x => x.subject.Contains(temp)).ToList());
}
Not sure what type your result type is hence the List<object>...