0

I have client ios app. In my server side I read the device OS version and based on the version type I perform actions. I get the OS version as string object and then converting it to double for comparison like greater than 6.0 or not like this. When device language is set to English all works fine. But when some languages like Swedish, chineese are set in device, I have trouble in parsing the incoming input.

The value I receive from device is like "7.0"

string sOSVersion = getOSVersionFromDevice();//"7.0"`
double dOSVersion = double.Parse(sOSVersion);// in this line invalid input exception occurs.
Hans Roerdinkholder
  • 2,979
  • 1
  • 18
  • 30
shatthi
  • 656
  • 3
  • 10
  • 22
  • Have you tried debugging it to see what string you're getting from the device. It could be that you're getting the version in another locale (for example, `7,0` instead of `7.0`) – iggymoran Sep 16 '14 at 14:17
  • I get as 7.0 only from the device – shatthi Sep 17 '14 at 05:20
  • In a similar fashion to my previous comment, have you tried parsing it with `CultureInfo.InvariantCulture`? http://stackoverflow.com/questions/1354924/how-do-i-parse-a-string-with-a-decimal-point-to-a-double – iggymoran Sep 17 '14 at 08:37

0 Answers0