-1

I'm reading .txt file and spliting values into array like this:

for (int i = 0; i < articleItems.Length; i++)
{
    List<string> splitStrings = articleItems[i].Split(new[] { "  " }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList();
    splitStrings[0] = splitStrings[0].Substring(12);
}

After that I'm trying to make object from those values, and everything is fine, but strange thing are happening here...

Here is the image from debugger, there is 14.80 at the beginning and when I convert that string to decimal it becomes 1480...:

enter image description here

rokie12234
  • 57
  • 1
  • 10
  • @LynnCrumbling I've tried it before and it didn't worked.. – rokie12234 May 09 '19 at 12:52
  • Use: Convert.ToDecimal(splitStrings[3], new CultureInfo("en-US")); See: https://learn.microsoft.com/en-us/dotnet/api/system.convert.todecimal?view=netframework-4.8#System_Convert_ToDecimal_System_String_System_IFormatProvider_ – lionthefox May 09 '19 at 12:54

1 Answers1

1

Try

Double.Parse(splitStrings[2].ToString())
JustasG
  • 31
  • 5