The list of methods to do String Code Point are organized into topic(s).
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 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")
+ "\"";