escapeHtml function

String escapeHtml(
  1. String text
)

Implementation

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