Trimming white space

Try this code in the Translator:

local Life = " This is life "; Life = Life:trimWS()

You’ll see something like this:

The function trims white space from either side of the string. It’s important to know that stripped string is returned - Lua strings are ‘immutable’. Once created they cannot be altered - you can point a variable at a new string.

Related pages