Trim

Strings
Aptilis 1

Trim(String)

Trim removes blank spaces from the begining and the end of a string you pass to it. In effect, it removes characters which ASCII codes are less than 33. (Spaces, tabs, line-feeds, etc.) à la Java.

Return Value:
The string given minus blank characters at the end and begining.

Example:

test = "  Vaiko " $
print("1. [", trim(test$)$, "]\n")
print("2. [", trim("  le chien")$, "]\n")
print("3. [", trim("leelou  ")$, "]\n")
print("4. [", trim("le chat")$, "]\n")
print("5. [", trim("")$, "]\n")
print("6. [", trim("16 06 70")$, "]\n")
Result:
1. [Vaiko]
2. [le chien]
3. [leelou]
4. [le chat]
5. []
6. [16 06 70]