escapeAttribute static method
Escape for use inside an HTML attribute value
Implementation
static String escapeAttribute(String input) {
return input
.replaceAll('&', '&')
.replaceAll('"', '"')
.replaceAll("'", ''')
.replaceAll('<', '<')
.replaceAll('>', '>');
}