OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 28 Jan 2014 01:52 AM |
I want to make all characters the opisite from the letter in the alphabet in a string. Exmaple:
A Z M would turn into Z A N |
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 28 Jan 2014 01:53 AM |
| How would i go about doing this? |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 28 Jan 2014 02:26 AM |
Rot13 basically? Do ascii stuff. Get the ascii codes, add 13 to them, then turn them to characters. |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2014 07:01 AM |
local char = "M"
function reverse(char) if char:match("[A-Z]") then return string.char(2 * 65 + 25 - char:byte()) elseif char:match("[a-z]") then return string.char(2 * 97 + 25 - char:byte()) end end
print(reverse(char)) |
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
| |
|