htmlEncode function

String htmlEncode(
  1. String text
)

Implementation

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