makePrintable method

String makePrintable(
  1. String s
)

Implementation

String makePrintable(String s) {
  final result = StringBuffer();
  for (int i = 0; i < s.length; i++) {
    if (s.codeUnitAt(i) < 32 || s.codeUnitAt(i) > 126) {
      result.write('.');
    } else {
      result.writeCharCode(s.codeUnitAt(i));
    }
  }
  return result.toString();
}