Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Currency Style by tokyoamado
import re
euro_style = re.compile('\$\d{1,3}(?!(,\d{3}|\d,\d))(\.\d{3})*(,\d{1,2}(?!\d))?')
swap = { ',' : '.', '.' : ',' }
def checkio(text):
matches = euro_style.finditer(text)
tlist = list(text)
for match in matches:
for p in range(*match.span()):
if tlist[p] in '.,':
tlist[p] = swap[tlist[p]]
return ''.join(tlist)
Oct. 20, 2017