I have string that looks like this abc
and I want to split it to single chars/strings.
static List<String> split(String text ) {
List<String> list = new ArrayList<>(text.length());
for(int i = 0; i < text.length() ; i++) {
list.add(text.substring(i, i + 1));
}
return list;
}
public static void main(String... args) {
split("a\uD83D\uDC4Fb\uD83D\uDE42c")
.forEach(System.out::println);
}
As you might already notice instead of and I'm getting two weird characters:
a
?
?
b
?
?
c