escapeHtml function
- String input
Escapes HTML special characters in the input string.
Implementation
String escapeHtml(String input) {
return input
.replaceAll('&', 'and')
.replaceAll('<', '<')
.replaceAll('>', '>')
.replaceAll('"', '"')
.replaceAll("'", ''');
}