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

[stdlib] Add stol #3951

Open
wants to merge 1 commit into
base: nightly
Choose a base branch
from
Open

[stdlib] Add stol #3951

wants to merge 1 commit into from

Conversation

jjvraw
Copy link
Contributor

@jjvraw jjvraw commented Jan 16, 2025

Introduces stol for more flexible string-to-integer parsing (issue #2639).

Implementation and logic closely follows that of atol. The function parses integer literals with base handling (2-36), supports base prefixes, and stops at the first invalid character. Unlike atol, it returns a tuple (parsed_int, remaining_string), allowing partial parsing without raising errors.

Signed-off-by: Joshua James Venter <[email protected]>
@jjvraw jjvraw requested a review from a team as a code owner January 16, 2025 16:55
@jjvraw
Copy link
Contributor Author

jjvraw commented Jan 16, 2025

Hi @JoeLoser

Opened a new PR for this. Too many conflicts to resolve when trying to resolve the DCO issues.

Question: Since stol is a more permissible atol, should we avoid raising for an empty string, this seems sensible?

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

Successfully merging this pull request may close these issues.

1 participant