static void trim(STRING& str) { static const WCHAR Spaces[] = L" \t\r\n"; size_t i = str.find_first_not_of(Spaces); size_t j = str.find_last_not_of(Spaces); if (i == STRING::npos || j == STRING::npos) { str.clear(); } else { str = str.substr(i, j - i + 1); } }