By the rule described: just convert the number to integer and divide by 100.
I took the opportunity to do with LINQ, so each line of the file will return an item to the list valores
.
var valores = File.ReadAllLines(@"C:\teste\pedro.txt")
.Select(l => (decimal)Convert.ToInt32(l) / 100)
.ToList();
foreach(var val in valores)
Console.WriteLine(val);
See working on . NET Fiddle.
Considering that each file will have only one line, it would be better to do so:
var strVal = File.ReadAllLines("C:\teste\pedro.txt")[0];
decimal valor = Convert.ToInt32(strVal) / 100m;
But what is the rule, young man? The last two will always be the decimal part?
– Jéf Bueno
@LINQ I will try to explain better, for example if it is 000000010 this corresponds to 0,10 if it is 000010000 this corresponds to 100 understood ?
– Pedro Azevedo
This I already understood at the beginning. Anyway, you want these values as numeric or as string?
– Jéf Bueno
@NUMERICAL LINQ
– Pedro Azevedo
Ready
– Jéf Bueno