Conversion to/from string to Math Numeric and decimal separator
We need a reliable way to convert strings to/from Math Numeric data structure regardless of the user profile's decimal separator setting (comma or dot). The string will always contain dot (.) as the decimal separator.
Can someone confirm that we can use:
- ParseNumericStringEx to convert the string with decimal separator dot (.) to a math numeric as follows:
ParseNumericStringEx(&mnTest, szTest, DEFAULT_SEPARATOR);
Example conversions:
Source (szTest) | Destination (mnTest.szString / mnTest.nDecimalPoistion) | |
---|---|---|
50.01 | Dot Separator ==> "50.01" / 2 Comma Separator ==> "50,01" / 2 | |
10 |
| |
15.123 | Dot Separator ==> "15.123" / 3 Comma Separator ==> "15,123" / 3 |
- FormatMathNumericDefault to do the reverse, i.e.convert a math numeric to the string representation with decimal separator dot (.) :