@Test public void codepoints() { assertArrayEquals(new int[]{65536}, Strings.codePoints("\uD800\uDC00")); assertArrayEquals(new int[]{9731}, Strings.codePoints("☃")); }
public static int[] codePoints(String s) { int length = s.length(); int arrayPointer = 0; int stringPointer = 0; int[] codepoints = new int[length]; while (stringPointer < length) { int codepoint = s.codePointAt(stringPointer); codepoints[arrayPointer++] = codepoint; stringPointer += Character.charCount(codepoint); } return arrayPointer == stringPointer ? codepoints : Arrays.copyOf(codepoints, arrayPointer); }
Strings { public static int[] codePoints(String s) { int length = s.length(); int arrayPointer = 0; int stringPointer = 0; int[] codepoints = new int[length]; while (stringPointer < length) { int codepoint = s.codePointAt(stringPointer); codepoints[arrayPointer++] = codepoint; stringPointer += Character.charCount(codepoint); } return arrayPointer == stringPointer ? codepoints : Arrays.copyOf(codepoints, arrayPointer); } }
Strings { public static int[] codePoints(String s) { int length = s.length(); int arrayPointer = 0; int stringPointer = 0; int[] codepoints = new int[length]; while (stringPointer < length) { int codepoint = s.codePointAt(stringPointer); codepoints[arrayPointer++] = codepoint; stringPointer += Character.charCount(codepoint); } return arrayPointer == stringPointer ? codepoints : Arrays.copyOf(codepoints, arrayPointer); } private  Strings(); }
Strings { public static int[] codePoints(String s) { int length = s.length(); int arrayPointer = 0; int stringPointer = 0; int[] codepoints = new int[length]; while (stringPointer < length) { int codepoint = s.codePointAt(stringPointer); codepoints[arrayPointer++] = codepoint; stringPointer += Character.charCount(codepoint); } return arrayPointer == stringPointer ? codepoints : Arrays.copyOf(codepoints, arrayPointer); } private  Strings(); static int[] codePoints(String s); static boolean isNullOrEmpty(String s); static String nullToEmpty(String value); static String sanitizeWhitespace(String str); }
Strings { public static int[] codePoints(String s) { int length = s.length(); int arrayPointer = 0; int stringPointer = 0; int[] codepoints = new int[length]; while (stringPointer < length) { int codepoint = s.codePointAt(stringPointer); codepoints[arrayPointer++] = codepoint; stringPointer += Character.charCount(codepoint); } return arrayPointer == stringPointer ? codepoints : Arrays.copyOf(codepoints, arrayPointer); } private  Strings(); static int[] codePoints(String s); static boolean isNullOrEmpty(String s); static String nullToEmpty(String value); static String sanitizeWhitespace(String str);  }