Nicolas Raoul
Nicolas Raoul

Reputation: 60203

Convert a double to a SQL-friendly string on Android?

My open-source Android application uses this in an SQL query:

String.format("%f", someDoubleValue);

Unfortunately, in some languages the coma is "," instead of "." and the SQL engine does not like it.

What is the best way to convert a double to a SQL-friendly string on Android?

Upvotes: 1

Views: 1436

Answers (1)

Nicolas Raoul
Nicolas Raoul

Reputation: 60203

My wild guess:

Locale nullLocale = null;
String.format(nullLocale, "%f", someDoubleValue);

I don't have any means to test it now, unfortunately.

Upvotes: 1

Related Questions