GetStringTypeA

BOOL GetStringTypeA(

LCID  lcid,

DWORD  dwInfoType,

LPCSTR  lpSrcStr,

int  cchSrc,

LPWORD  lpCharType,

);


Retrieves locale type information about each character in a string.

Parameters

lcid
Locale context for the mapping. The string is assumed to be represented in the default ANSI code page for this locale.
dwInfoType
Type of character information to retrieve. The various types are divided into different levels. (See the Comments section for a list of information included in each type). The options are mutually exclusive. The following types are supported:
lpSrcStr
String for which character types are requested. If cchSrc is –1, lpSrcStr is assumed to be null-terminated.
cchSrc
Character count of lpSrcStr. If cchSrc is –1, lpSrcStr is assumed to be null-terminated. This must also be the character count of lpCharType.
lpCharType
Array of the same length as lpSrcStr (cchSrc). On output, the array contains one word corresponding to each character in lpSrcStr.

Return Value

Return value Meaning
0 Failure.
1 Success.

Comments

The lpSrcStr and lpCharType pointers cannot be the same. In this case, the error ERROR_INVALID_PARAMETER results.

The character type bits are divided up into several levels. One level's information can be retrieved by a single call.

This function supports three character types:

Ctype 1 character types support ANSI C and POSIX character typing functions. A bitwise OR of these values is returned when dwInfoType is set to CT_CTYPE1. For DBCS locales, the Ctype 1 attributes apply to both narrow characters and wide characters. The Japanese hiragana and katakana characters, and the kanji ideograph characters all have the C1_ALPHA attribute.

The following table lists the Ctype 1 character types.

Name Value Meaning
C1_UPPER 0x0001 Uppercase1.
C1_LOWER 0x0002 Lowercase1.
C1_DIGIT 0x0004 Decimal digits.
C1_SPACE 0x0008 Space characters.
C1_PUNCT 0x0010 Punctuation.
C1_CNTRL 0x0020 Control characters.
C1_BLANK 0x0040 Blank characters.
C1_XDIGIT 0x0080 Hexadecimal digits.
C1_ALPHA 0x0100 Any letter.
1    The Windows version 3.1 functions IsCharUpper and IsCharLower do not always produce correct results for characters in the range 0x80-0x9f, so they may produce different results than this function for characters in that range. (For example, the German Windows version 3.1 language driver incorrectly reports 0x9a, lowercase s hacek, as uppercase).

Ctype 2 character types support the proper layout of text. For DBCS locales, Ctype 2 applies to both narrow and wide characters. The directional attributes are assigned so that the BiDi layout algorithm standardized by Unicode produces the correct results. For more information on the use of these attributes, see The Unicode Standard: Worldwide Character Encoding from Addison-Wesley publishers.

Attribute Name Value Meaning
Strong C2_LEFTTORIGHT 0x1 Left to right.
C2_RIGHTTOLEFT 0x2 Right to left.
Weak C2_EUROPENUMBER 0x3 European number, European digit.
C2_EUROPESEPARATOR 0x4 European numeric separator.
C2_EUROPETERMINATOR 0x5 European numeric terminator.
C2_ARABICNUMBER 0x6 Arabic number.
C2_COMMONSEPARATOR 0x7 Common numeric separator.
Neutral C2_BLOCKSEPARATOR 0x8 Block separator.
C2_SEGMENTSEPARATOR 0x9 Segment separator.
C2_WHITESPACE 0xA White space.
C2_OTHERNEUTRAL 0xB Other neutrals.
Not applicable C2_NOTAPPLICABLE 0x0 No implicit direction (for example, control codes).

Ctype 3 character types are general text-processing information. A bitwise OR of these values is returned when dwInfoType is set to CT_CTYPE3. For DBCS locales, the Ctype 3 attributes apply to both narrow characters and wide characters. The Japanese hiragana and katakana characters, and the kanji ideograph characters all have the C3_ALPHA attribute.

Name Value Meaning
C3_NONSPACING 0x1 Nonspacing mark.
C3_DIACRITIC 0x2 Diacritic nonspacing mark.
C3_VOWELMARK 0x4 Vowel nonspacing mark.
C3_SYMBOL 0x8 Symbol.
C3_KATAKANA 0x10 Katakana character.
C3_HIRAGANA 0x20 Hiragana character.
C3_HALFWIDTH 0x40 Narrow character.
C3_FULLWIDTH 0x80 Wide character.
C3_IDEOGRAPH 0x100 Ideograph.
C3_ALPHA 0x8000 Any letter.
C3_NOTAPPLICABLE 0x0 Not applicable.