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

Fix typo and improved algo for isAllDigits #5828

Closed

Conversation

SinghRajenM
Copy link
Contributor

@SinghRajenM SinghRajenM commented Jun 25, 2019

As explained 344850a#r33867431 I was trying to correct the typo.

Then I realized, as we are checking each character one by one, then do we really need to call ::isdigit? So instead of calling ::isdigit why don't we check ASCII value for 0~9 and return result accordingly.

P.S. Still I favor PR #4530.

@donho donho added the accepted label Jun 25, 2019
@donho donho added this to the 7.x (master) milestone Jun 25, 2019
@donho donho self-assigned this Jun 25, 2019
@donho donho closed this in 105dceb Jun 25, 2019

bool isDigit = ::isdigit(int(i)) != 0;
if (!isDigit)
if (i < 48 || i > 57)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this still work when str is a wide string?
Notepad++ is build with UNICODE enabled thus generic_string will be a wide string.

@zufuliu
Copy link
Contributor

zufuliu commented Jun 25, 2019

That code is not readable, what's wrong with not using '0' and '9'?

@SinghRajenM SinghRajenM deleted the src_typo20190625 branch June 26, 2019 05:04
kspalaiologos pushed a commit to kspalaiologos/notepad-plus-plus that referenced this pull request Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants