Parses a string as a normalized number according to the locale settings.
(string)
| 314 | return _format("%.12g", val) |
| 315 | |
| 316 | def delocalize(string): |
| 317 | "Parses a string as a normalized number according to the locale settings." |
| 318 | |
| 319 | conv = localeconv() |
| 320 | |
| 321 | #First, get rid of the grouping |
| 322 | ts = conv['thousands_sep'] |
| 323 | if ts: |
| 324 | string = string.replace(ts, '') |
| 325 | |
| 326 | #next, replace the decimal point with a dot |
| 327 | dd = conv['decimal_point'] |
| 328 | if dd: |
| 329 | string = string.replace(dd, '.') |
| 330 | return string |
| 331 | |
| 332 | def localize(string, grouping=False, monetary=False): |
| 333 | """Parses a string as locale number according to the locale settings.""" |
no test coverage detected