-
Notifications
You must be signed in to change notification settings - Fork 446
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
Add lower and upper string operations to stringify header. #4933
base: main
Are you sure you want to change the base?
Conversation
There are |
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.
Thanks for this and for putting it to a separate PR.
lib/stringify.h
Outdated
|
||
/// Convert a string to upper case. This is not safe for non-ASCII strings. | ||
/// Performs the up operation in place. | ||
void upperinPlace(std::string &s); |
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.
void upperinPlace(std::string &s); | |
void upperInPlace(std::string &s); |
lib/stringify.h
Outdated
@@ -123,6 +123,21 @@ cstring toString(const void *value); | |||
|
|||
char DigitToChar(int digit); | |||
|
|||
/// Convert a string to lower case. This is not safe for non-ASCII strings. | |||
/// Performs the lowering operation in place. | |||
void lowerinPlace(std::string &s); |
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.
void lowerinPlace(std::string &s); | |
void lowerInPlace(std::string &s); |
lib/stringify.h
Outdated
/// Performs the lowering operation in place. | ||
void lowerinPlace(std::string &s); | ||
|
||
/// Convert a string to lower case. This is not safe for non-ASCII strings. |
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.
It is (probably) "safe" in a sense it will not crash. It is just not what might be expected (e.g. locale-aware UTF-8 lowercase).
I always forget we have Abseil now.. I will use these instead of transform then |
0a134e4
to
53ea8d7
Compare
Signed-off-by: fruffy <fruffy@nyu.edu>
53ea8d7
to
217816f
Compare
The test fails for non-ascii characters. I will wait for C++20, maybe there is something that can be done here then. |
No description provided.