Determines if a character is punctuation (decimal 32?47, 58?63, 91?96, 123?126).
int ispunct( int ch );
ch - character to classify
Non-zero value if the character is a punctuation character, zero otherwise.
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
/*from w ww. ja v a2 s . co m*/
int main(void){
unsigned char c = '\xd7'; // the character ? (multiplication sign) in ISO-8859-1
printf("In the default C locale, \\xd7 is %spunctuation\n",
ispunct(c) ? "" : "not " );
setlocale(LC_ALL, "en_GB.iso88591");
printf("In ISO-8859-1 locale, \\xd7 is %spunctuation\n",
ispunct(c) ? "" : "not " );
}
The code above generates the following result.