Formatting Raw Numbers
The class RWLocale from the Essential Tools Module provides an easy way to convert between strings that represent numbers into the basic long or double data types for any locale. The number strings can even contain the national equivalents of the thousand and decimal point separators.
Example 23 – Formatting raw numbers
void
insertFrenchNumber(RWDBDatabase& aDB)
{
RWLocaleSnapshot france("fr");
//If we're already in a french locale - use this line instead
//RWLocale& france= *RWLocale::global();
 
RWCString aNumberAsAString("12.345,67");
double aNumber(0.0);
france.stringToNum(aNumberAsAString, &aNumber);
 
RWDBInserter ins = aDB.table("t3").inserter();
 
ins << aNumber;
 
cout << ins.asString(true) << endl;
}
The output from this example should be an SQL insert statement like this:
 
INSERT INTO t3 VALUES ( 1.2345670000000e+04 )