#include#include #include #include #include #include using namespace std; int main() { string str = " Hello World "; StringUtil::trim(str); cout << str << endl; // Outputs "Hello World" return 0; }
#include#include #include using namespace std; int main() { string str = "Hello,World,This,Is,A,Test"; vector substrings = StringUtil::split(str, ","); for(auto s : substrings) { cout << s << endl; } return 0; }
#include#include using namespace std; int main() { string str = "1234"; int num = StringUtil::toInt(str); cout << num << endl; // Outputs "1234" return 0; }