MCPcopy Create free account
hub / github.com/google/re2j / stringToRunes

Method stringToRunes

java/com/google/re2j/Utils.java:88–99  ·  view source on GitHub ↗
(String str)

Source from the content-addressed store, hash-verified

86
87 // Returns the array of runes in the specified Java UTF-16 string.
88 static int[] stringToRunes(String str) {
89 int charlen = str.length();
90 int runelen = str.codePointCount(0, charlen);
91 int[] runes = new int[runelen];
92 int r = 0, c = 0;
93 while (c < charlen) {
94 int rune = str.codePointAt(c);
95 runes[r++] = rune;
96 c += Character.charCount(rune);
97 }
98 return runes;
99 }
100
101 // Returns the Java UTF-16 string containing the single rune |r|.
102 static String runeToString(int r) {

Callers 2

literalRegexpMethod · 0.95
sMethod · 0.80

Calls 1

lengthMethod · 0.45

Tested by 1

sMethod · 0.64