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

parseInt accepts more than digits #23513

Open
nitely opened this issue Apr 18, 2024 · 0 comments
Open

parseInt accepts more than digits #23513

nitely opened this issue Apr 18, 2024 · 0 comments
Labels
Documentation Content Related to documentation content (not generation).

Comments

@nitely
Copy link
Contributor

nitely commented Apr 18, 2024

Description

parseInt accepts an initial sign and any number of underscores after the first digit, but the documentation does not mention this.

import std/parseutils

var res: int
echo parseInt("-123", res)
echo res
echo parseInt("+123", res)
echo res
discard parseInt("1__2__3____", res)
echo res

Nim Version

Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-04-17
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 20698b8
active boot switches: -d:release

Current Output

4
-123
4
123
123

Expected Output

the same output

Possible Solution

Document what is accepted as input.

Additional Information

No response

@ringabout ringabout added the Documentation Content Related to documentation content (not generation). label Apr 18, 2024
litlighilit added a commit to litlighilit/Nim that referenced this issue May 2, 2024
Also, the old `runnableExample` is just a copy of `proc parseInt(openArray[char], var int, int)` variant (in Line 1000).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Content Related to documentation content (not generation).
Projects
None yet
Development

No branches or pull requests

2 participants