public static void sop1(String source, String text) {
IntStream sourceStream = source.codePoints();
IntStream textStream = text.codePoints();
List<Integer> textCollect = textStream.boxed().collect(Collectors.toList());
int textSize = textCollect.size();
int asInt = textCollect.get(0);
System.out.println(asInt);
List<Integer> collect = sourceStream.boxed().collect(Collectors.toList());
int size = collect.size();
int index = collect.indexOf(asInt);
int start = 0;
int end = 0;
if (index - 5 <= 0) {
start = 0;
} else {
start = index - 5;
}
if (index + 5 + textSize >= size) {
end = size;
} else {
end = index + 5 + textSize;
}
System.out.println(size);
Syste
java 截取带表情(emoji)的字符串
最新推荐文章于 2024-05-12 09:33:54 发布