How can I use string.sub to remove a something from a value? I’m sending some data to all servers using the messaging service and I want to remove the last 3 letters from the data I sent using string.sub.
local str = "hello"
str = string.sub(str, 1, string.len(str)-3)
print(str)
just make sure the string has more than 3 characters or it’ll error.
1 Like