Encrypting a String

Hi. I created a similar request before, but my solution to it had worked in a way that was helpful, however I realize now that I’ve mislabelled some important parts of it.

I wish to create a script in which changes letters only, not special characters such as “.”, “,” and other characters, to different positions inside of the alphabet, whilst also maintain uppercase/lowercase. For example, if I were to push them all by one:

“AbCdE.”
Would then become:
“BcDeF.”

However, as per a small amount of knowledge on string manipulation, I’m unsure of how I should complete this.

1 Like
local text = "AbCdE"

local newString = ""
for c in text:gmatch"." do --iterate through each char
    local characterByte = c:byte() 
    newString = newString .. string.char(characterByte+1)--shift it forwards according to your pattern
end
print(newString)  -- BcDeF

For the special characters I believe you can do it on your own using the equality operator like so

if c == "." then
--do stuff like ignore it