lundi 31 août 2015

Order by long Distance from Google Distance Matrix

Google Distance Matrix API for long distance between the origin and destination respond with a blank space when it's > 1000km: "1 865"

When I try to order the result using LINQ:

.OrderBy(g => Double.Parse(g.Distance, CultureInfo.GetCultureInfo("pt-PT")))

I get the error:

System.FormatException: Input string was not in a correct format.
at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)

I tried to remove the blank space using g.Distance.replace(" ","") but it's not working.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire