Basically, it starts at the LAST character of the total string, and checks to see if it is a space(==32).
If it is NOT a space-character, it truncates everything 'beyond' this point, and exits the loop.
If it IS a space-character, it loops over to checks the next character back, et al.

note: variable "pos' is which byte it is currently checking,
and variable 'trunc' gets set to how many characters got truncated.

[EDIT] Ive just changed to snippet so the variable names are more descriptive...

Last edited by EvilSOB; 04/01/10 21:24.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial