我如何检测非打印字符在.NET? [英] How do I detect non-printable characters in .NET?
本文介绍了我如何检测非打印字符在.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想知道,如果在.NET 2.0的方法来检查一个字符是否可打印或不 - 像 isprint判断(INT)
从标准C.
I'm just wondering if there is a method in .NET 2.0 that checks whether a character is printable or not – something like isprint(int)
from standard C.
我发现 Char.IsControl(字符)
。
莫非是被用于此目的?
推荐答案
您可能需要使用的 Char.IsControl(字符)
。这是我使用的是什么。你肯定不希望使用<为0x20
的方法,因为任何非拉丁字符和大多数非英文字符将高于127
You might want to use Char.IsControl(Char)
. That is what I'm using. You definitely do not want to use the <0x20
method because any non-latin character and most non-english characters will be above 127.
这篇关于我如何检测非打印字符在.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文