formatAscii static method

String formatAscii(
  1. int byte
)

Convert byte to ASCII character or placeholder Returns middle dot (·) for non-printable characters

Implementation

static String formatAscii(int byte) {
  if (byte >= 0x20 && byte <= 0x7E) {
    return String.fromCharCode(byte);
  }
  return '·';
}