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

前端 未结 4 2080
花落未央
花落未央 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
    2020-12-30 19:19

    private bool IsPrintableCharacter(char candidate)
    {
        return !(candidate < 0x20 || candidate > 127);
    }
    

提交回复
热议问题