This any good? (Cause this post totally needs another answer :)
string trimBegin(string str)
{
string whites = "\t\r\n ";
int i = 0;
while (whites.find(str[i++]) != whites::npos);
str.erase(0, i);
return str;
}
Similar case for the trimEnd, just reverse the polari- er, indices.