htmlEscape function

String htmlEscape(
  1. String text
)

Simple HTML escaping function

Implementation

String htmlEscape(String text) {
  return text
      .replaceAll('&', '&')
      .replaceAll('<', '&lt;')
      .replaceAll('>', '&gt;')
      .replaceAll('"', '&quot;')
      .replaceAll("'", '&#39;');
}