Added private helper method to Java QrSegmentAdvanced.

pull/39/merge
Project Nayuki 6 years ago
parent 0bf2d3306b
commit 719caf4d99

@ -257,13 +257,18 @@ public final class QrSegmentAdvanced {
public static boolean isEncodableAsKanji(String text) {
Objects.requireNonNull(text);
for (int i = 0; i < text.length(); i++) {
if (UNICODE_TO_QR_KANJI[text.charAt(i)] == -1)
if (!isKanji(text.charAt(i)))
return false;
}
return true;
}
private static boolean isKanji(char c) {
return UNICODE_TO_QR_KANJI[c] != -1;
}
// Data derived from ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/SHIFTJIS.TXT
private static final String PACKED_QR_KANJI_TO_UNICODE =
"MAAwATAC/wz/DjD7/xr/G/8f/wEwmzCcALT/QACo/z7/4/8/MP0w/jCdMJ4wA07dMAUwBjAHMPwgFSAQ/w8AXDAcIBb/XCAmICUgGCAZIBwgHf8I/wkwFDAV/zv/Pf9b/10wCDAJMAowCzAMMA0wDjAPMBAwEf8LIhIAsQDX//8A9/8dImD/HP8eImYiZyIeIjQmQiZA" +

Loading…
Cancel
Save