Remove Whitespace From Beginning and End of String

How do I remove whitespace from the beginning and end of a string, so this string
ab c becomes ab c?

1 Like
local strings = "  abc  "
strings = string.gsub(strings, "^%s+", "")
strings = string.gsub(strings, "%s+$", "")
print(strings)
5 Likes