MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / delocalize

Function delocalize

tools/python-3.11.9-amd64/Lib/locale.py:316–330  ·  view source on GitHub ↗

Parses a string as a normalized number according to the locale settings.

(string)

Source from the content-addressed store, hash-verified

314 return _format("%.12g", val)
315
316def 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
332def localize(string, grouping=False, monetary=False):
333 """Parses a string as locale number according to the locale settings."""

Callers 2

atofFunction · 0.85
atoiFunction · 0.85

Calls 2

localeconvFunction · 0.85
replaceMethod · 0.45

Tested by

no test coverage detected