I have a raspberry pi with system language set to "de_DE.UTF-8" and mono version 3.28 installed. My programs need to convert Strings
into Doubles
, but I ran into a few problems:
Double.Parse("500", NumberStyles.Float, CultureInfo.InvariantCulture);
Works just fine.
Double.Parse("500.123", NumberStyles.Float, CultureInfo.InvariantCulture);
Throws FormatException
, what is weird.
Double.Parse("500,123", NumberStyles.Float, CultureInfo.GetCultureInfo("de-DE"));
Throws FormatException
too;
The funny thing is if I change my system language (sudo raspi-config) to "en-GB.UTF-8" all functions work as expected. Anyone knows how to solve this as a German user I would like to use German system settings.
该错误在单声道3.4中修复,尚未上传到raspberry repo中
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.