How do I detect non-printable characters in .NET?

前端 未结 4 2069
花落未央
花落未央 2020-12-30 18:43

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.

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 19:22

    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.

提交回复
热议问题