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

Added string utility functions to trim, filter and convert. #2322

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

paulhoux
Copy link
Collaborator

Compared to previous version of the code, I have renamed the in-place versions to *InPlace. They usually perform way better than their copy versions. To prevent issues with the current locale, I have removed calls to std::setlocale and left these for the user. The valueToString functions use std::to_string which performs slightly better than the older ci::toString() function.

@paulhoux paulhoux requested a review from andrewfb December 29, 2023 16:21
@paulhoux paulhoux self-assigned this Dec 29, 2023
@paulhoux paulhoux force-pushed the string-utility-functions branch from 613b4d1 to e1b5374 Compare January 2, 2024 10:33
@paulhoux
Copy link
Collaborator Author

paulhoux commented Jan 2, 2024

I am thinking of renaming filter and filterInPlace to removeAnyOf and removeAnyOfInPlace.

Furthermore, it should be possible to rewrite findReplace in such a way that it becomes UTF8 compatible. I could try this code.

…Also tweaked the `filterInPlace` function and comments.
@totalgee
Copy link
Contributor

Nice. But how come none of the new valueToString() functions are declared in the Utilities.h file? Also, though Cinder is not yet on C++20, the implementation of these functions should possibly be switched from std::to_string() to std::format() in C++20, which is very fast and particularly good for (by default) printing floating point numbers with just the required precision. (See the examples here.

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.

2 participants