List of utility methods to do String Code Point
int | toCodePoint(char high, char low) to Code Point return (high - HIGH_SURROGATE_MIN_VALUE) * 0x400 + (low - LOW_SURROGATE_MIN_VALUE) + 0x10000;
|
int | toCodePoint(char highSurrogate, char lowSurrogate) to Code Point return MIN_SUPPLEMENTARY_CODE_POINT + ((highSurrogate & 1023) << 10) + (lowSurrogate & 1023);
|
int | toCodePoint(char[] chars) to Code Point return toCodePoint(chars[0], chars[1]);
|
int[] | toCodePointArray(final String str) to Code Point Array if (str != null) { final int len = str.length(); final int[] acp = new int[str.codePointCount(0, len)]; for (int i = 0, j = 0; i < len; i = str.offsetByCodePoints(i, 1)) { acp[j++] = str.codePointAt(i); return acp; return new int[0]; |
int[] | toCodePointArray(String string) Transforms a String to its representative array of unicode code points. char[] sarray = string.toCharArray(); int[] result = new int[Character.codePointCount(sarray, 0, sarray.length)]; for (int i = 0, j = 0, codePoint = 0; i < sarray.length; i += Character.charCount(codePoint)) { codePoint = Character.codePointAt(sarray, i); result[j++] = codePoint; return result; |
int | toCodePoints(char[] src, int srcOff, int srcLen, int[] dest, int destOff) Converts a sequence of Java characters to a sequence of unicode code points. if (srcLen < 0) { throw new IllegalArgumentException("srcLen must be >= 0"); int codePointCount = 0; for (int i = 0; i < srcLen;) { final int cp = Character.codePointAt(src, srcOff + i, srcOff + srcLen); final int charCount = Character.charCount(cp); dest[destOff + codePointCount++] = cp; ... |
int[] | toCodepoints(String message) to Codepoints int[] codepoints = new int[message.length()]; for (int i = 0; i < message.length(); i++) { codepoints[i] = message.codePointAt(i); return codepoints; |
int[] | toCodePoints(String s) Convert the string to an array of code points. return s.codePoints().toArray();
|
int[] | toCodePoints(String str) to Code Points int count = str.codePointCount(0, str.length()); int[] codePoints = new int[count]; for (int cpIndex = 0, charIndex = 0; cpIndex < count; cpIndex++) { int cp = str.codePointAt(charIndex); codePoints[cpIndex] = cp; charIndex += Character.charCount(cp); return codePoints; ... |
String | toCodeString(String s) Given a string, returns a string that could be printed out in Java source code. return "\"" + s.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n").replace("\t", "\\t") + "\""; |