function trim(s) return (string.gsub(s, "^%s*(.-)%s*$", "%1")) end string1 = " RUNOOB " string2 = trim(string1) print(string2)