rtrim
function rtrim( str ) --> nstr
Description
The rtrim function returns the string stripped of whitespace from the right side.
Parameters
- str
-
The string that should be trimmed.
Return Values
- nstr
-
A trimmed version of the assigned parameter string.
Code
--ZFUNC-rtrim-v1 local function rtrim( str ) --> nstr local n = str:find( "%S%s*$" ) return n and str:sub( 1, n ) or "" end return rtrim
Examples
--ZFUNC-rtrim-v1 local function rtrim( str ) --> nstr local n = str:find( "%S%s*$" ) return n and str:sub( 1, n ) or "" end return rtrim