Java String Code Point toCodePoints(String str)

Here you can find the source of toCodePoints(String str)

Description

to Code Points

License

Apache License

Declaration

public static int[] toCodePoints(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int[] toCodePoints(String str) {
        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;//from  w ww.  j  a v a 2 s . c om
            charIndex += Character.charCount(cp);
        }
        return codePoints;
    }
}

Related

  1. toCodePointArray(final String str)
  2. toCodePointArray(String string)
  3. toCodePoints(char[] src, int srcOff, int srcLen, int[] dest, int destOff)
  4. toCodepoints(String message)
  5. toCodePoints(String s)
  6. toCodeString(String s)