sanitize static method

String sanitize(
  1. String text
)

Replaces every line break in text, including the folding white space that follows it, with a single space.

Implementation

static String sanitize(String text) {
  if (!text.contains('\r') && !text.contains('\n')) {
    return text;
  }

  return text.replaceAll(_lineBreakPattern, ' ');
}