ifx_gl_ismalnum, ifx_gl_ismalpha, ifx_gl_ismblank, ifx_gl_ismcntrl, ifx_gl_ismdigit, ifx_gl_ismgraph, ifx_gl_ismlower, ifx_gl_ismprint, ifx_gl_ismpunct, ifx_gl_ismspace, ifx_gl_ismupper, ifx_gl_ismxdigit, ifx_gl_iswalnum, ifx_gl_iswalpha, ifx_gl_iswblank, ifx_gl_iswcntrl, ifx_gl_iswdigit, ifx_gl_iswgraph, ifx_gl_iswlower, ifx_gl_iswprint, ifx_gl_iswpunct, ifx_gl_iswspace, ifx_gl_iswupper, ifx_gl_iswxdigit - determine the class of one character

SYNOPSIS

#include <ifxgls.h>

int ifx_gl_ismalnum(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismalpha(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismblank(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismcntrl(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismdigit(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismgraph(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismlower(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismprint(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismpunct(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismspace(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismupper(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_ismxdigit(gl_mchar_t *mb, int mb_byte_limit); int ifx_gl_iswalnum(gl_wchar_t wc); int ifx_gl_iswalpha(gl_wchar_t wc); int ifx_gl_iswblank(gl_wchar_t wc); int ifx_gl_iswcntrl(gl_wchar_t wc); int ifx_gl_iswdigit(gl_wchar_t wc); int ifx_gl_iswgraph(gl_wchar_t wc); int ifx_gl_iswlower(gl_wchar_t wc); int ifx_gl_iswprint(gl_wchar_t wc); int ifx_gl_iswpunct(gl_wchar_t wc); int ifx_gl_iswspace(gl_wchar_t wc); int ifx_gl_iswupper(gl_wchar_t wc); int ifx_gl_iswxdigit(gl_wchar_t wc);

DESCRIPTION

These functions test whether mb (or wc) are in the respective character class according to the rules of the current locale.

If mb_byte_limit is IFX_GL_NO_LIMIT then the multi-byte functions will read as many bytes as necessary from mb to form a complete character; otherwise, they will not read more than mb_byte_limit bytes from mb when trying to form a complete character. See Multi-Byte Character Termination for more general information about mb_byte_limit.

CLASSES

upper

True if the character is an upper-case alphabetic character. The ASCII characters `A' through `Z' and all other single and multi-byte upper-case characters for Latin-based languages are in this class.

Characters in this class are also in the alpha, graph and print classes. No characters in the lower, digit, blank, space, punct or cntrl classes are in this class.

The lower-case equivalent of each character in this class can be determined by calling ifx_gl_tomlower() or ifx_gl_towlower().

lower

True if the character is a lower-case alphabetic character. The ASCII characters `a' through `z' and all other single and multi-byte lower-case characters for Latin-based languages are in this class.

Characters in this class are also in the alpha, graph and print classes. No characters in the upper, digit, blank, space, punct or cntrl classes are in this class.

The upper-case equivalent of each character in this class can be determined by calling ifx_gl_tomupper() or ifx_gl_towupper().

alpha

True if the character is an alphabetic character. All characters from the upper and lower classes are also in this class. In addition to the upper-case and lower-case Latin-based characters, this class includes any: (1) Asian ideographic characters; for example, Kanji characters, (2) Asian phonetic characters; for example, single-byte and multi-byte Katakana and Hiragana characters, (3) Non-ASCII digit characters; see the digit class, (4) Latin-based alphabetic characters which do not have a case-equivalent character, (5) User-defined characters, (6) Vendor-defined characters.

Characters in this class are also in the graph and print classes. No characters in the digit, blank, space, punct or cntrl classes are in this class.

digit

True if the character is a digit character. Only the 10 ASCII digit characters are in this class. Multi-byte versions of these digits or alternative representations of these digits (for example, Hindi or Kanji digits) are not in this class, instead they are in the alpha class.

Characters in this class are also in the xdigit, graph and print classes. No characters in the upper, lower, alpha, blank, space, punct or cntrl classes are in this class.

xdigit

True if the character is a hexadecimal digit character. Only the 10 ASCII digit characters, 'A' through 'F', and 'a' through 'f' are in this class. Multi-byte versions of these hex digits or alternative representations of these hex digits (for example, Hindi or Kanji digits) are not in this class, instead they are in the alpha class.

Characters in this class are also in the graph and print classes. No characters in the blank, space, punct or cntrl classes are in this class.

alnum

True if the character is either in the alpha or digit class.

blank

True if the character is a horizontal space character. The single-byte space and tab characters plus any multi-byte version of these characters are in this class.

Characters in this class are also in the space class. No characters in the upper, lower, alpha, digit, xdigit, punct or graph classes are in this class.

space

True if the character is a horizontal or vertical space character. All characters from the blank class are also in this class. In addition to the blank characters, this class contains the single-byte and multi-byte versions of newline, vertical-tab, form-feed and carriage-return.

No characters in the upper, lower, alpha, digit, xdigit, punct or graph classes are in this class.

cntrl

True if the character is a control character. The single-byte characters alert, backspace, tab, newline, vertical-tab, form-feed, carriage-return, NUL, SOH, STX, ETX, EOT, ENQ, ACK, SO, SI, DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB, CAN, EM, SUB, ESC, IS4, IS3, IS2, IS1, DEL plus any other control characters are in this class.

No characters in the upper, lower, alpha, digit, xdigit, punct, graph or print classes are in this class.

punct

True if the character is a punctuation character. The single-byte ASCII punctuation characters plus any non-ASCII punctuation characters are in this class.

Graphic characters which are not really punctuation characters have traditionally been put in the punct class; instead they are in the graph class.

Characters in this class are also in the graph and print classes. No characters in the upper, lower, alpha, digit, xdigit, blank, space or cntrl classes are in this class.

graph

True if the character is a graphical character. All characters which have a visual representation are in this class. All characters from the upper, lower, alpha, digit, punct and xdigit classes are also in this class.

All round-trip codeset conversion placeholder characters are in this class.

Characters in this class are also in the print class. No characters in the blank, space or cntrl classes are in this class.

print

True if the character is a printable character. All characters which have a visual representation or are in the space class but not in the cntrl are in this class.

All characters from the upper, lower, alpha, digit, punct, xdigit and graph classes are also in this class. No characters in the cntrl class are in this class.

RETURN VALUES

These functions return non-zero if mb (or wc) is in the respective character class; otherwise they return zero.

ERRORS

If an error has occurred, these functions returns zero and ifx_gl_lc_errno() returns,
[IFX_GL_EILSEQ]
mb is not a valid multi-byte character (or wc is not a valid wide-character)
[IFX_GL_EINVAL]
The function cannot determine whether mb is a valid multi-byte character, because it would need to read more than mb_byte_limit bytes from mb. If mb_byte_limit is less than or equal to zero, this function always gives this error. See Keeping Multi-Byte Strings Consistent for more information about this error.
Since these functions do not return a special value if an error has occurred, to detect an error condition, the caller of this function must set ifx_gl_lc_errno() to zero before calling these functions and check ifx_gl_lc_errno() after calling the function. For example,
  ifx_gl_lc_errno() = 0;

  value = ifx_gl_iswalpha(wc);

  if ( ifx_gl_lc_errno() != 0 )
    /* Handle error */
  else if ( value != 0 )
    /* Is in class */
  else if ( value == 0 )
    /* Is not in class */
  ...

SEE ALSO

ifx_gl_tomupper() ifx_gl_tomlower() ifx_gl_towupper() ifx_gl_towlower()

ACKNOWLEDGEMENT

Portions of this description were derived from the X/Open CAE Specification: "System Interfaces and Headers, Issue 4"; X/Open Document Number: C202; ISBN: 1-872630-47-2; Published by X/Open Company Ltd., U.K.