isOnlyDoubleByteKanji static method

bool isOnlyDoubleByteKanji(
  1. String content
)

Implementation

static bool isOnlyDoubleByteKanji(String content) {
  final bytes = StringUtils.shiftJisCharset.encode(content);
  final length = bytes.length;
  if (length % 2 != 0) {
    return false;
  }
  for (int i = 0; i < length; i += 2) {
    final byte1 = bytes[i] & 0xFF;
    if ((byte1 < 0x81 || byte1 > 0x9F) && (byte1 < 0xE0 || byte1 > 0xEB)) {
      return false;
    }
  }
  return true;
}