Jump to content

UniQueryChar

From EDM2
Revision as of 21:55, 10 December 2023 by Martini (talk | contribs) (Returns)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UniQueryChar determines if the character supplied has the attribute(s) requested.

Syntax

int UniQueryChar (UniChar uc, ULONG attr)

Parameters

uc (UniChar) - input
The Unicode character whose attribute(s) are being examined.
attr (ULONG) - input
The attribute being examined in the Unicode character.

Returns

Return value (int) - returns
Return values
0
The specified attribute is false for the specified Unicode character.
1
The specified attribute is true for the specified Unicode character.

Remarks

This function takes the attributes supplied by the caller and tests the character to determine if they are true for that Unicode character. Attribute values are listed under UniQueryAttr; only the standard POSIX attributes (CT_* or C1_*) may be used.

Example

This example shows how to query if a character has particular attributes.

#include <stdio.h>
#include <unidef.h>

int main(void) {

     int          result = 0;
     UniChar      uni_char = L'A';    /* Unicode A character */

     /* Query character for upper case and graphic attributes */
     result = UniQueryChar(uni_char, C1_UPPER | C1_GRAPH);
     if (result)
       printf("UniChar is upper case and a graphic character\n");
     else
       printf("UniChar is not upper case and a graphic character\n"_;

     return ULS_SUCCESS;
}

Format

#include <unidef.h>

int UniQueryChar (
    UniChar uc,     /* I  - Character to query      */
    ULONG   attr    /* I  - Symbolic attribute name */
)

Related Functions