Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Try this code in the translator:

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

You’ll see something like this:

Image RemovedImage Added

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.