I have a text file that needs parsing in the app and this was tested on my UK device and a US device. This same text file is used by Android and iPhone apps that work fine. It has been reported to me that some people on Windows Phones this does not work!
It turns out if the device is set to a region like Germany that uses the comma “,” as the decimal point then the following code does not work properly!
GeoCoordinate tempCoord = new GeoCoordinate();
tempCoord.Latitude = Convert.ToDouble(words[0]);
tempCoord.Longitude = Convert.ToDouble(words[1]);
As words comes in as a string I’m not sure how else I can get this into a double from a string?
EDIT:
On a slightly related note the following is also causing me grief!
geoWatcher.Position.Location.Latitude.ToString()
This will return 56,888 for European and 56.888 for US/UK!
Arrrgh!
Instead of using
Convert.ToDouble, usedouble.parse(...):There is also an overload of
double.ToString()that takes a formatter, and you can use this overload to produce string representations of adoublein whatever manner you wish.