JS:
oldString = "I really love this font for some reason!";
var oldF = 0;
var newF = 1;
fonts = ["abcdefghijklmnopqrstuvwxyz0123456789 !@#$%^&*()_+-=[]{};'\\:\"|,./<>?","abcdefghijklmnopqrstuvwxyz0123456789 !@#$%^&*()_+-=[]{};'\:"|,./<>?","ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ⁰¹²³⁴⁵⁶⁷⁸⁹ ","ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⓪①②③④⑤⑥⑦⑧⑨ ","ɐqɔpǝɟƃɥıɾʞlɯuodbɹsʇnʌʍxʎz0ƖᄅƐㄣϛ9ㄥ86 "];
newString = oldString;
for (i = 0; i < fonts[oldF].length; i++) {
var re = new RegExp(fonts[oldF][i], "gi");
newString = newString.replace(re, fonts[newF][i]);
}
if (newF == 4 ^ oldF == 4) {
var o = '';
for (var i = newString.length - 1; i >= 0; i--) {
o += newString[i];
}
newString = o;
}
console.log(newString);
now at line 17 (var re = new ...) it gives an "nothing to repeat" error, the problem is that I use 'i' to select a character from the string (char array) 'fonts' which means if I use escape characters, it will choose the '\' but I actually want ( to be taken in entirely, I don't know of a better way than to put these special cases in a separate function or to detect an escape character and handle that differently.