Skip to content

Commit ae1214e

Browse files
committed
Add toUpperCase/toLowerCase free functions for std::string
1 parent 112e67b commit ae1214e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/Processing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,8 @@ inline bool toBoolean(const ::std::string& s) { return s=="true"||s=="1"
14171417
inline int toInt(const ::std::string& s) { return ::std::stoi(s); }
14181418
inline float toFloat(const ::std::string& s) { try { return ::std::stof(s); } catch (...) { return 0.0f; } }
14191419
inline char toChar(int v) { return static_cast<char>(v); }
1420+
inline ::std::string toUpperCase(::std::string s) { for(auto& c:s) c=::std::toupper((unsigned char)c); return s; }
1421+
inline ::std::string toLowerCase(::std::string s) { for(auto& c:s) c=::std::tolower((unsigned char)c); return s; }
14201422
inline ::std::string trim(const ::std::string& s) {
14211423
size_t a=s.find_first_not_of(" \t\n\r"), b=s.find_last_not_of(" \t\n\r");
14221424
return a==::std::string::npos ? "" : s.substr(a, b-a+1);

0 commit comments

Comments
 (0)