Page 1 of 1

what exactly does the trim function do?

Posted: 11 Jan 2020 10:49
by tsolignani
Good morning everyone,

Maybe owing to my comprehension difficulties in English, I don't understand well what the trim function does.

Does it remove white spaces / blank only at the beginning and at the end of a string or all the white spaces into the string are replaced?

Will it work with carriage return characters as well (\n)?

Thank you.

Re: what exactly does the trim function do?

Posted: 11 Jan 2020 17:49
by Desmanto
Yes, all white space including tab (\t), newline either \r or \n. Example

Code: Select all

a = "\tHello World\t\n\r";
b = a + "123";
c = trim(a) + "123";
If you look at debug dialog, b show 123 below the line. While c use the trimmed a, and it shows 123 right next to the world.

Re: what exactly does the trim function do?

Posted: 11 Jan 2020 20:42
by tsolignani
Thank you. So it does work only on white spaces left or right and not in the middle.