6
exelix
6y

Just wasted two hours because C# float.parse only allows dots for decimal places and ignores commas..... But float.tostring uses a comma WTF.
I was writing an obj file exporting the vertices with tostring, then when loading the model would show up broken but in other 3d applications it worked.
Who did come up this bright idea ?

Comments
  • 0
    And does it account for some countries using . and , the other way round?
  • 0
    @d4ng3r0u5 probably since it depends on the culture settings.
    in my case float.Parse("1.6") is 1.6 and float.Parse("1,6") is 16, on a vm i have it's the opposite,i solved by setting the thread culture to InvariantCulture, but before parsing new files i'll always replace commas with dots to be safe
Add Comment