Go: proposal: strconv: make ParseFloat support fraction unicode characters

Created on 30 Jun 2018  Β·  6Comments  Β·  Source: golang/go

It would be nice if ParseFloat would support these characters:

Β½,↉, β…“, β…”, ΒΌ, ΒΎ, β…•, β…–, β…—, β…˜, β…™, β…š, ⅐, β…›, β…œ, ⅝, β…ž, β…‘, β…’

FeatureRequest FrozenDueToAge Proposal

Most helpful comment

Sorry, but no. ParseFloat is for decimals. We're not going to start recognizing circled-1234 etc either.

If you think others would find this useful, it would make sense to publish an external package providing this functionality. It doesn't have to be in the standard library.

All 6 comments

BTW: I'm only suggesting these be treated as a special case.

Do people need this? Does a library exist that does this? How popular is it?

I came across a use-case and I assumed the library would convert "9Β½" to 9.5. I think it's a low-priority "nice-to-have" feature.

the library would convert "9Β½" to 9.5

What is "9β…“" converted to?

@ALTree It can be documented what a 1/3 will become but it should be the most appropriate representation of 1/3 that a float64 can produce. It can be set by fiat and documented.

Sorry, but no. ParseFloat is for decimals. We're not going to start recognizing circled-1234 etc either.

If you think others would find this useful, it would make sense to publish an external package providing this functionality. It doesn't have to be in the standard library.

Was this page helpful?
0 / 5 - 0 ratings