如何从字符串中删除表情符号我的简单代码是..
public static void main(String[] args) throws SQLException {
String str="My nam is ur -D ";
getRefineCode(str);
}
private static void getRefineCode(String str) throws {
List smstypeWord=getshortWord();
for(int i=0;i<smstypeWord.size();i++) {
String string=smstypeWord.get(i).toString();
String stringcon[]=string.split("_");
String emessage=stringcon[0];
String emoticon=stringcon[1].trim();
if(str.contains(emoticon)) {
str=str.replace(emoticon, emessage);
System.out.println("=================>"+str);
}
}
System.out.println("=======++==========>"+str);
}
private static List getshortWord() throws SQLException {
String query1 = "SELECT * FROM englishSmsText";
PreparedStatement ps = conn.prepareStatement(query1);
ResultSet rs = ps.executeQuery();
String f_message="";
String s_message="";
while(rs.next()) {
s_message=rs.getString("message");
f_message=rs.getString("short_text");
shortMessage.add(s_message+"_"+f_message);
//fullMessage.add(f_message);
}
return shortMessage;
}
我的数据库基于http://smsdictionary.co.uk/abbreviations网站
我能够理解如何删除多个 abb。或短信
输出就像 My nam is You are SquintLaughtGrinisappGaspoooh!!shockedintedr, Big SmilGrinisappGaspoooh!!shockedinted, Grin