stripLow function

String stripLow(
  1. String str, {
  2. bool keepNewLines = false,
})

remove characters with a numerical value < 32 and 127.

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

Implementation

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