Say I have the following Javascript:
var userString = "..."; // e.g. "cats < dogs"
How do I get userString
with all html characters escaped?
E.g. I want cats < dogs
.
Also, how do I do the same thing with escaping all URL characters?
E.g. I want cats%20%3C%20dogs
I realize I could use a function such as this, but it seems to be non-exhaustive. E.g. it's missing "
.
Since Javascript does not seem to have a built-in method, I'm hoping that Google Apps Script has a built-in solution.