//---------------------------------------------------------------- void RemoveWhitespace(cString &szString) { // Remove leading whitespace size_t nFirstIndex = szString.find_first_not_of(_L(' ')); if(nFirstIndex != cString::npos) { szString = szString.substr(nFirstIndex); } // Remove trailing newlines size_t nLastIndex = szString.find_last_not_of(_L('\n')); while(nLastIndex != szString.length()-1) { szString.erase(nLastIndex+1,1); nLastIndex = szString.find_last_not_of(_L('\n')); }; // Tabs nLastIndex = szString.find_last_not_of(_L('\t')); while(nLastIndex != szString.length()-1) { szString.erase(nLastIndex+1,1); nLastIndex = szString.find_last_not_of(_L('\t')); }; // Spaces nLastIndex = szString.find_last_not_of(_L(' ')); while(nLastIndex != szString.length()-1) { szString.erase(nLastIndex+1,1); nLastIndex = szString.find_last_not_of(_L(' ')); }; }