cclass() — Return characters in a character class
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C Library | both |
Format
#include <collate.h>
int cclass(char *class, collel_t **list);
General description
Finds all the collating elements of the class, class. The list is updated to point to the array of collating elements found. The list is valid until the next call to setlocale().
The function supports user-defined character classes. In C Library programs, the function also supports POSIX.2 character classes.
Returned value
If successful, cclass() returns the number of elements in the list pointed to by list.
If the first argument specifies a class that does not exist in the LC_CTYPE category of the current locale, cclass() returns -1.
Example
CELEBC02
/* CELEBC02 */
#include <stdio.h>
#include <collate.h>
int main(void)
{
collel_t *list; /* ptr to the digit class collation weights */
int weights; /* no. of class collation class weights found */
int i;
weights = cclass("digit", &list);
printf("weights=%d\n", weights);
for (i=0; i<weights; i++)
printf("*(list + %d) = %d\n", i, *(list + i) );
}
Related information
- collate.h
- locale.h
- “Internationalization: Locales and Character Sets” in z/OS XL C/C++ Programming Guide
- collequiv() — Return a list of equivalent collating elements
- collorder() — Return list of collating elements
- collrange() — Calculate the range list of collating elements
- colltostr() — Return a string for a collating element
- getmccoll() — Get next collating element from string
- getwmccoll() — Get next collating element from wide string
- ismccollel() — Identify a multicharacter collating element
- maxcoll() — Return maximum collating element
- setlocale() — Set locale
- strtocoll() — Return collating element for string
- wctype() — Obtain handle for character property classification