I want to convert localized strings to numbers; including the decimal separator and/or thousands separator. It works for strings where there is only a "." as decimal separator, but won't work, i.e. returns nil
, for the following cases:
- "21,1" (expected: 21.1)
- "1,231.0" (expected: 1231.0)
- "1.000.101,044" (expected: 1000101.044)
The problem is that I won't know which locale is set beforehand so the conversion must be generic.
Is there a locale-dependent string to number conversion?