I have this code .
<code>
Regex regDollar= new System.Text.RegularExpressions.Regex("[0-9]+.[0-9][0-9]"
inputFile=new StreamReader(path);
buffer=inputFile.ReadLine().TrimStart(null);
Match mObj ;
Total1=decimal.Parse( regDollar.Match(buffer).ToString());
mObj = regDollar.Match(buffer).NextMatch();
Total2=decimal.Parse(mObj.ToString()) ;
mObj = regDollar.Match(buffer).NextMatch() ;
Total3=decimal.Parse(mObj.ToString());
vsSystems.Item(reportSystemID).Materials.Insert(cSINumber,laborTotal+materialTotal+equipmentTotal);
Console.Write("\nTotal1: + " + Total1 + "\tTotal2 = " + Total2 + "\tTotal3 + " + Total3 + "\n\n\n\n" ;
The lines that are being retrieved by ReadLine() are like this:
418.25 382.76 12.45
The value retrieved by the third Match (the Total3) is the value retrieved in the second match (Total2). This is always the case for some reason. For instance, in the above example, Total1 would be 418.25, Total2 would be 382.76 and Total3 would also be 382.76 . It should be 12.45 though.
I'm trying to figure out what the problem is but so far I haven't.
Any help in this regard would be appreciated ..
Thanks.
Saad
<code>
Regex regDollar= new System.Text.RegularExpressions.Regex("[0-9]+.[0-9][0-9]"
inputFile=new StreamReader(path);
buffer=inputFile.ReadLine().TrimStart(null);
Match mObj ;
Total1=decimal.Parse( regDollar.Match(buffer).ToString());
mObj = regDollar.Match(buffer).NextMatch();
Total2=decimal.Parse(mObj.ToString()) ;
mObj = regDollar.Match(buffer).NextMatch() ;
Total3=decimal.Parse(mObj.ToString());
vsSystems.Item(reportSystemID).Materials.Insert(cSINumber,laborTotal+materialTotal+equipmentTotal);
Console.Write("\nTotal1: + " + Total1 + "\tTotal2 = " + Total2 + "\tTotal3 + " + Total3 + "\n\n\n\n" ;
The lines that are being retrieved by ReadLine() are like this:
418.25 382.76 12.45
The value retrieved by the third Match (the Total3) is the value retrieved in the second match (Total2). This is always the case for some reason. For instance, in the above example, Total1 would be 418.25, Total2 would be 382.76 and Total3 would also be 382.76 . It should be 12.45 though.
I'm trying to figure out what the problem is but so far I haven't.
Any help in this regard would be appreciated ..
Thanks.
Saad