Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.3 KB

020i_ispunct.asciidoc

File metadata and controls

62 lines (45 loc) · 1.3 KB

ispunct

#include <ctype.h>

int ispunct   (char c);
int ispunct_l (int c, locale_t locale);
DESCRIPTION

Checks if the given character is a punctuation character in the current C locale. The default C locale classifies the characters !"#$%&'()*+,-./:;<⇒?@[\]^_{|}~` as punctuation.

The behavior is undefined if the value of c is not representable as unsigned char and is not equal to EOF.

RETURN VALUE

Non-zero value if the character is a punctuation character, zero otherwise.

SEE ALSO

isalnum, isalpha, isblank, iscntrl, isdigit, isgraph, islower, isprint, isspace, isupper, isxdigit

EXAMPLE
link:src/ispunct1.c[role=include]
OUTPUT
$ gcc -Wall ispunct1.c
$ ./a.out
ispunct (_) YES
ispunct (`) YES
ispunct (a) NO
ispunct (b) NO
EXAMPLE
link:src/ispunct2.c[role=include]
OUTPUT
$ gcc -Wall ispunct2.c
$ ./a.out
In the default C locale, \xd7 is not punctuation
In ISO-8859-1 locale, \xd7 is punctuation