android非法字符的判定、表情符号的判定

来源:互联网 发布:二维码标签机打印软件 编辑:程序博客网 时间:2024/05/16 11:16

记录一下,以便后续自己查看


               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}.*" 是判断表情符号



0 0
原创粉丝点击