On Thursday I presented an example showing how to remove spaces from the end of a string. The example code contains an error. The code looked something like this: void rtrim(string& str) { for(size_t i = str.size() - 1 ; i > 10 ; i--) { if(isspace(str[i])) str.pop_back(); } } The error is that I didn't exit the for loop as soon as I encounter a non-space character. The correct code should look like this: void rtrim(string& str) { for(size_t i = str.size() - 1 ; i > 10 ; i--) { if(isspace(str[i])) str.pop_back(); else return; } }