-
Notifications
You must be signed in to change notification settings - Fork 123
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
Utils/StringUtil: Fixes ltrim and adds a unittest #4171
Conversation
899a7d8
to
0eacc86
Compare
889ce7f
to
ee54635
Compare
Nice - lgtm. :) |
Is there a reason we are not using Or the equivalent using |
Haven't really looked at it, but I assume the predication would have different behaviour. I'm obviously not a very big C++ buff, using things for convenience rather than knowing every detail of it. |
Ah, actually I have tried it and it wouldn't work because erase_if would remove all white space instead of just trimming it, so it seems like your approach is the best unless you want to get into views and ranges etc. But it's simpler as you have it. Sorry for the noise. |
unittests/APITests/StringUtils.cpp
Outdated
@@ -0,0 +1,96 @@ | |||
#include <catch2/catch_test_macros.hpp> | |||
#include <catch2/generators/catch_generators.hpp> |
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.
this include is probably not needed
ltrim had the issue that it would always consume the left-most character even if it wasn't whitespace. So `FEXLoader` would turn in to `EXLoader`, even without any whitespace in the string. Adds a test to ensure this doesn't occur again.
ee54635
to
47369d0
Compare
ltrim had the issue that it would always consume the left-most character even if it wasn't whitespace. So
FEXLoader
would turn in toEXLoader
, even without any whitespace in the string.Adds a test to ensure this doesn't occur again.