isPunctuation

@safe pure nothrow @nogc
bool
isPunctuation
(
dchar c
)

Return Value

Type: bool

Whether or not c is a punctuation character. That includes all ASCII characters which are not control characters, letters, digits, or whitespace.

Examples

1 assert( isPunctuation('.'));
2 assert( isPunctuation(','));
3 assert( isPunctuation(':'));
4 assert( isPunctuation('!'));
5 assert( isPunctuation('#'));
6 assert( isPunctuation('~'));
7 assert( isPunctuation('+'));
8 assert( isPunctuation('_'));
9 
10 assert(!isPunctuation('1'));
11 assert(!isPunctuation('a'));
12 assert(!isPunctuation(' '));
13 assert(!isPunctuation('\n'));
14 assert(!isPunctuation('\0'));
15 
16 // N.B.: Non-ASCII Unicode punctuation characters are not recognized.
17 assert(!isPunctuation('\u2012')); // (U+2012 = en-dash)

Meta

Suggestion Box / Bug Report