How to add char at beginning and end of string

Hi! I’ trying to insert a character at the beginning and end of a string, How would I do that?

local text = "Your text"
local charToAdd = ":"

text = charToAdd .. text .. charToAdd

print(text)

I used a variable for your character to add mostly for ease of access if you plan on doing this multiple times in multiple parts of the script, but you can choose not to use a variable

Used an online compilter and it gave this

image

1 Like
text = ":" .. text .. ":"