- result = string.trim(s [, i [, j]])
- result = string.trimr(s [, i [, j]])
- result = string.triml(s [, i [, j]])
SYNOPSIS
DESCRIPTION
These functions remove whitespace from the substring s[i], s[i+1], ···, s[j]. The default value for i is 1; the default value for j is the number of characters in s.
The function string.trim() removes both leading and trailing whitespace, while the function string.trimr() removes trailing whitespace and string.triml() removes leading whitespace.
Whitespace are all characters for which ctype.isspace() returns true.
RETURN VALUE
Returns a string.
EXAMPLE
>
>
>
print(string.format("[%s]", string.trim(" 12345 ")))
print(string.format("[%s]", string.trimr(" 12345 ")))
print(string.format("[%s]", string.triml(" 12345 ")))
[12345]
[ 12345]
[12345 ]