-
Notifications
You must be signed in to change notification settings - Fork 171
Added APIs isalnum()
and isnumeric()
in string object
#2572
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
Conversation
isalnum()
in string objectisalnum()
and isnumeric()
in string object
I'll resolve all the conflicts here (if any) once the review is done. |
src/bin/CLI11.hpp
Outdated
/// Verify that str consists of letters or numbers only | ||
inline bool isalnum(const std::string &str) { | ||
return std::all_of(str.begin(), str.end(), [](char c) { return std::isalnum(c, std::locale()); }); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this implementation? Where is it being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it works without this being present too. I had put it here as isalpha() was present here, but I think that is for some other reason. I have removed this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shared a query above. The rest seems good to me. Conflicts need to be resolved. I will review again after conflicts are resolved.
Please let me know a fast way to resolve such conflicts. These have appeared as I had changed references in this PR: #2574, which has now been merged. I had made both these PRs by branching from the main branch that existed before I made that PR. |
I always commit updation of reference tests in a separate commit (with the fixed message "TEST: Update reference tests"). That way if there are conflicts between the reference test updates of my branch and the main branch, I can just drop my commit "TEST: Update reference tests" and then rebase over the |
For now, maybe try this (make a separate branch before trying so that you can always recover your changes). git rebase --strategy-option ours main
git clean -dfx
./build.sh
./run_tests.sh -u
git add tests
git commit -m "TEST: Update reference tests" |
If this does not work, a simple option could be to create a new branch from There can also be another option in which you rebase and edit your commit Implemented isnumeric() to only include changes related to source code and exclude changes related to reference tests. Next you drop your commits related to changes in reference tests (using git rebase again) and finally rebase over main. Now you can update tests and commit them without any conflicts. |
Please mark this PR ready for review once it is ready. |
As there were too many conflicts, I have created a new PR: #2582 |
Finished and merged: #2582 |
Towards: #2356
APIs added:
These have been tested extensively, for both compile time and run time tests.