• Put ... at the end of a string if it gets too large
    2 replies, posted
I'm really bad with manipulating strings and I was wondering if I could get some help with something. How would I see if a string is larger than 11 characters and if it is, go to 8 characters and replace the last three characters with "..."?
[lua] local str = "This is a very large string!" if str:len() > 11 then str = str:sub(1, 8) .. "..." end print(str) -- This is ... [/lua]
[QUOTE=maurits150;42679807][lua] local str = "This is a very large string!" if str:len() > 11 then str = str:sub(1, 8) .. "..." end print(str) -- This is ... [/lua][/QUOTE] Thank you!
Sorry, you need to Log In to post a reply to this thread.