stripLow method

String stripLow(
  1. String str,
  2. [bool keepNewLines]
)

remove characters with a numerical value < 32 and 127.

If keepNewLines is true, newline characters are preserved (\n and \r, hex 0xA and 0xD).

Implementation

String stripLow(String str, [bool keepNewLines]) {
  String chars = keepNewLines == true
      ? '\x00-\x09\x0B\x0C\x0E-\x1F\x7F'
      : '\x00-\x1F\x7F';
  return blacklist(str, chars);
}