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

Feature wishes for int_of_string #8485

Closed
vicuna opened this issue Feb 16, 2004 · 1 comment
Closed

Feature wishes for int_of_string #8485

vicuna opened this issue Feb 16, 2004 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Feb 16, 2004

Original bug ID: 2262
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: standard library

Bug description

Full_Name: Shawn Wagner
Version: 3.07+2
OS: linux
Submission from: dialup-67.75.195.222.dial1.seattle.level3.net (67.75.195.222)

It'd be nice if int_of_string and related functions could skip over any leading
or trailing spaces in their arguments, rather than raising Failure like it was a
malformed numeric string. Also, versions that take a argument for what base to
convert from would be useful, instead of having to add a prefix to a string
before calling int_of_string.

@vicuna vicuna added the stdlib label Mar 14, 2019
@nojb
Copy link
Contributor

nojb commented Mar 15, 2019

This seems out of scope: the "XXX_of_string" functions in the stdlib are not meant to be used as general parsing functions; they are "merely" the inverses of the string_of_XXX.

To skip leading & trailing whitespace one can simply call String.trim on the argument of int_of_string.

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

No branches or pull requests

2 participants