Home / Lua / Shared / string / trim


Returns    string
Prototype    string.trim(string string)
Description    Removes any preceding or succeeding whitespaces from the string.

Examples

local inputstring = "    hi there.   What's up?     "
local trimmed = string.trim(inputstring)

print("\"" .. inputstring .. "\"")
--> "    hi there.   What's up?     "

print("\"" .. trimmed .. "\"")
--> "hi there.   What's up?"