void StringTest::testTrimInPlace() { { std::string s = "abc"; assert (trimInPlace(s) == "abc"); } { std::string s = " abc "; assert (trimInPlace(s) == "abc"); } { std::string s = " ab c "; assert (trimInPlace(s) == "ab c"); } }
ofxTweakbarType::ofxTweakbarType(ofxTweakbar* pBar, string pName, void* pValue) :bar(pBar) ,name(pName) ,value(pValue) { trimInPlace(name); toLowerInPlace(name); string clean_name; for(int i = 0; i < name.size(); ++i) { if(isalnum(name[i])) { clean_name.push_back(name[i]); } else { clean_name.push_back('_'); } } name = clean_name; }
void trim(string& str) { trimInPlace(str); }