記錄一下,以便後續自己查看
public void onTextChanged(CharSequence s, int start,
int before, int count) {
if (s.toString().length() <= 0
|| s.toString().matches(".*[/\\\\:*?\"<>|\t].*") || s.toString().matches(".*\\p{So}.*")) { //jimbo rep for bug 13191
// || s.toString().matches(".*[/\\\\:*?\"<>|\t].*")) {
// characters not allowed
//if (count>=0&&s.toString().substring(start).matches(".*[/\\\\:*?\"<>|\t].*")) {
if (count>=0&&s.toString().substring(start).matches(".*[/\\\\:*?\"<>|\t].*") || s.toString().substring(start).matches(".*\\p{So}.*")) { //jimbo rep
mToastHelper
.showToast(R.string.invalid_char_prompt);
}
}
}
其中 ".*\\p{So}.*" 是判斷表情符號