我通过空格来拆分这个字符串:String input = ":-) :) :o) :] :3 :c) :> =] 8) =) :} :^)";
(表情符号之间有空格)
结果如下:
:-)?:)?:o)?:]?:3?:c)?:>
=]
8)
=)?:}?:^)
结果中出现了一些奇怪的字符,我不知道为什么,请帮助我。
以下是代码:
fileReader = new BufferedReader(new FileReader("emoticon.txt"));
String line = "";
while ((line = fileReader.readLine()) != null){
String[] icons = parts[0].split("\\s+");
....
}
感谢您提供的建议。
这里有一个表情符号文件:
https://www.dropbox.com/s/6ovz0aupqo1utrx/emoticon.txt