void utStringUtils::replace( utString &in, const utString &from, const utString &to ) { if ( !from.empty() && from != to ) { // erase if ( to.empty() ) { size_t pos= 0; while ( pos != utString::npos ) { pos= in.find( from ); if ( pos != utString::npos ) in.erase( pos, from.size() ); } } else { size_t pos= 0; while ( pos != utString::npos ) { pos= in.find( from ); if ( pos != utString::npos ) { in.erase( pos, from.size() ); in.insert( pos, to ); } } } } }
void utStringUtils::trim( utString &in, const utString &expr ) { in.erase( in.find_last_not_of( expr ) + 1 ); in.erase( 0, in.find_first_not_of( expr ) ); }