Parses a string as a normalized number according to the locale settings.
(string)
| 304 | return _format("%.12g", val) |
| 305 | |
| 306 | def delocalize(string): |
| 307 | "Parses a string as a normalized number according to the locale settings." |
| 308 | |
| 309 | conv = localeconv() |
| 310 | |
| 311 | #First, get rid of the grouping |
| 312 | ts = conv['thousands_sep'] |
| 313 | if ts: |
| 314 | string = string.replace(ts, '') |
| 315 | |
| 316 | #next, replace the decimal point with a dot |
| 317 | dd = conv['decimal_point'] |
| 318 | if dd: |
| 319 | string = string.replace(dd, '.') |
| 320 | return string |
| 321 | |
| 322 | def localize(string, grouping=False, monetary=False): |
| 323 | """Parses a string as locale number according to the locale settings.""" |
no test coverage detected
searching dependent graphs…