Skip to content

Commit

Permalink
Move stringToCodePoints to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Nov 26, 2023
1 parent 605cdbb commit ca668ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 0 additions & 11 deletions lib/src/main/java/net/fellbaum/jemoji/EmojiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -526,17 +526,6 @@ public static String replaceEmojis(final String text, Function<Emoji, String> re
return replaceEmojis(text, replacementFunction, Arrays.asList(emojisToReplace));
}

private static int[] stringToCodePoints(String text) {
int[] codePoints = new int[getCodePointCount(text)];
int j = 0;
for (int i = 0; i < text.length();) {
final int codePoint = text.codePointAt(i);
codePoints[j++] = codePoint;
i += Character.charCount(codePoint);
}
return codePoints;
}

/*public static List<Emoji> testEmojiPattern(final String text) {
if (isStringNullOrEmpty(text)) return Collections.emptyList();
Expand Down
11 changes: 11 additions & 0 deletions lib/src/main/java/net/fellbaum/jemoji/EmojiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,15 @@ public static <K, V> Optional<V> findEmojiByEitherAlias(final Map<K, V> map, fin
if (secondValue != null) return Optional.of(secondValue);
return Optional.empty();
}

public static int[] stringToCodePoints(String text) {
int[] codePoints = new int[getCodePointCount(text)];
int j = 0;
for (int i = 0; i < text.length();) {
final int codePoint = text.codePointAt(i);
codePoints[j++] = codePoint;
i += Character.charCount(codePoint);
}
return codePoints;
}
}

0 comments on commit ca668ff

Please sign in to comment.