Exemplo n.º 1
0
/**
   Remove any prefix and suffix newlines from the specified
   string.
 */
static void trim(wcstring &str)
{
    if (str.empty())
        return;

    size_t pos = str.find_first_not_of(L" \n");
    if (pos > 0)
        str.erase(0, pos);

    pos = str.find_last_not_of(L" \n");
    if (pos != wcstring::npos && pos + 1 < str.length())
        str.erase(pos + 1);
}