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

assert( isPunctuation('.'));
assert( isPunctuation(','));
assert( isPunctuation(':'));
assert( isPunctuation('!'));
assert( isPunctuation('#'));
assert( isPunctuation('~'));
assert( isPunctuation('+'));
assert( isPunctuation('_'));

assert(!isPunctuation('1'));
assert(!isPunctuation('a'));
assert(!isPunctuation(' '));
assert(!isPunctuation('\n'));
assert(!isPunctuation('\0'));

// N.B.: Non-ASCII Unicode punctuation characters are not recognized.
assert(!isPunctuation('\u2012')); // (U+2012 = en-dash)

Meta