Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse Int64 supports whitespace, parse FixedDecimal does not #55

Open
mbravenboer opened this issue May 19, 2020 · 2 comments
Open

Parse Int64 supports whitespace, parse FixedDecimal does not #55

mbravenboer opened this issue May 19, 2020 · 2 comments

Comments

@mbravenboer
Copy link

Example:

julia> parse(Int64, "    5   ")
5

julia> parse(FixedDecimal{Int64,2}, "    5.0   ")
ERROR: ArgumentError: invalid digit: ' '

julia> parse(FixedDecimal{Int64,2}, "5.0")
FixedDecimal{Int64,2}(5.00)

julia> parse(Float64, "    3.14   ")
3.14

julia> parse(Float64, "    3 . 14   ")
ERROR: ArgumentError: cannot parse "    3 . 14   " as Float64
@omus
Copy link
Contributor

omus commented May 22, 2020

That's interesting. I'd personally lean towards parse(Int64, ...) and parse(Float64, ...) not support whitespace

@NHDaly
Copy link
Member

NHDaly commented May 22, 2020

Hmm, yeah i'm ambivalent. I guess accepting whitespace is also what C++'s parsing functions do as well (io >> x).

Given the julia behavior i'd say we should just do the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants