return mystring.replace(/&/g, "&").replace(/>/g, ">")
.replace(/</g, "<").replace(/"/g, """);
The above is my code, and I guess since it tracks the string 4 times, it makes it slower. Is there any other way (method prefered) to replace those special characters in only one loop? Well I can do it with a for loop and checking char by char, but it is not smthing I would like to.
Thanks.