What do ofTrim(), ofTrimBack() and ofTrimFront() do?

Hi, I wonder what they do.
I tried passing a string to these functions but I don’t see any change to the string.

Here’s my sample code:

string str = "  hello world  ";
cout << strlen(str.c_str()) << endl;
cout << strlen(str.c_str()) << endl;

And here’s the result I get:


What do these functions do?

They remove spaces but they don’t modify the original and instead return a new string so you need to do

str = ofTrim(str);
1 Like

Thank you! It works haha.