无法读取垃圾字符 [英] Unable to read junk characters

查看:69
本文介绍了无法读取垃圾字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何查找包含垃圾字符的字符串?

how can i find a string contains junk character or not ?

推荐答案

您可能可以做的是定义允许字符(或不允许字符)的正则表达式,具体取决于您的要求),然后如下所示对照字符串进行检查

What you can probably do is define a regex of allowed characters (or non-allowed characters, depending on your requirement), then check the string against it as shown below

Regex myCheck = new Regex("^[a-zA-Z0-9]*


" ); 如果(myCheck.IsMatch(myString)) { HandleNonAllowedcharacter(); }
"); if (myCheck.IsMatch(myString)) { HandleNonAllowedcharacter(); }



希望对您有帮助
-Milind



Hope that helps
-Milind


这篇关于无法读取垃圾字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆