escape static method

String escape(
  1. String text
)

Escape special XML characters in a text value

Implementation

static String escape(String text) {
  return text
      .replaceAll('&', '&')
      .replaceAll('<', '&lt;')
      .replaceAll('>', '&gt;')
      .replaceAll('"', '&quot;')
      .replaceAll("'", '&apos;');
}