Bug in sugar convert (iOS C#)

The following code puts into variable c “1,237” instead of expected “1.237”

float a = 1.237;
var c = Sugar.Convert.ToString(a);

What platform and what version?

iOS C# (Elements) as above and using latest beta 8.4.96.2019 also running on simulator (not sure if same on device but would assume so)

Update: I have my simulator set to French (Canada), guessing this maybe whats showing problem

Hm, then this might be as designed? FRance probably uses “,” as decimal separation? Use .ToStringInvariant or pass Locale.Invariant, to get “.”?

Great thanks sorry for the chase around ToStringInvariant indeed worked.

1 Like