C# Remove special characters

后端 未结 7 2462
孤街浪徒
孤街浪徒 2021-02-07 08:08

I want to remove all special characters from a string. Allowed characters are A-Z (uppercase or lowercase), numbers (0-9), underscore (_), white space ( ), pecentage(%) or the d

7条回答
  •  自闭症患者
    2021-02-07 08:54

    The first approach seems correct, except that you have a | (bitwise OR) instead of a || before c == '.'.

    By the way, you should state what doesn't work (doesn't it compile, or does it crash, or does it produce wrong output?)

提交回复
热议问题