How to get all the punctuation characters in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        for (char i = char.MinValue; i < char.MaxValue; i++) {
            if (char.IsPunctuation(i)) {
                Console.WriteLine("{0} {1}", i, (int)i);
            }
        }
    }
}



/*
run:

! 33
" 34
# 35
% 37
& 38
' 39
( 40
) 41
* 42
, 44
- 45
. 46
/ 47
: 58
; 59
? 63
@ 64
[ 91
\ 92
] 93
_ 95
{ 123
} 125
¡ 161
« 171
­ 173
· 183
» 187
¿ 191
; 894
· 903
՚ 1370
՛ 1371
՜ 1372
՝ 1373
՞ 1374
՟ 1375
։ 1417
֊ 1418
־ 1470
...

*/

 



answered Sep 13, 2020 by avibootz
...