I have a problem, as it has a variable of type string
and I need to convert to type double
without losing the "dot". Example: string latitude = "-8.709006"
when converting is equal to: -8.709006
But until then I have done several different tests and nothing.
string latitude = "-8.709006";
double lat = Double.Parse(latitude);
//Mas ele esta me trazendo: -8709006 e nao -8.709006
I've done it another way too but it does not get any results:
string latitude = "-8.709006";
System.Globalization.CultureInfo cult = new System.Globalization.CultureInfo("en-US");
double lat = double.Parse(latitude, cult);
//Desta vez o resultado foi: -8,709006 e nao -8.709006
As I also tried this:
string latitude = "-8.709006";
double lat = Double.Parse(latitude, System.Globalization.CultureInfo.InvariantCulture);
//E o resultado foi: -8,709006 e nao -8.709006