The first example is a function to trim extra white-spaces at the beginning
and end of a string.
function trim(s)
local _, i = strfind(s, '^ *')
local f, __ = strfind(s, ' *$')
return strsub(s, i+1, f-1)
end
The second example shows a function that eliminates all spaces
of a string.
function remove_blanks (s)
return gsub(s, "%s%s*", "")
end