Open thomasgeissl opened 2 years ago
I find myself always adding little string helper functions. I think startsWith and endsWith will be added for cpp20.
does it make sense to add something like this to the core?
//ofEndsWith static bool ofDoesStringEndWith(const std::string &str, const std::string &suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } //ofStartsWith static bool ofDoesStringStartWith(const std::string &str, const std::string &prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); }
t
I would find these functions very useful. I would rather use ofStringStartsWith and ofStringEndsWith for the names.
ofStringStartsWith
ofStringEndsWith
Implementation may use C++20 starts_with() and ends_with() when available.
starts_with()
ends_with()
I find myself always adding little string helper functions. I think startsWith and endsWith will be added for cpp20.
does it make sense to add something like this to the core?
t