ContainsOnlyCharType function
Syntax
ContainsOnlyCharType(source_str, char_code_list)
Where char_code_list is a list of character set codes in the form:
char_code_1 [, char_code_2]. . .
Description
Use the ContainsOnlyCharType function to determine whether every character in source_str belongs to one or more of the character types in char_code_list. See the following Parameters section for a list of valid character code values. Most character types supported by this function equate to specific Unicode character blocks or are based on Unicode character properties.
Parameters
| Parameter | Description |
|---|---|
|
Source_str |
String to be examined. |
|
char_code_list |
A comma-separated list of character set codes. |
|
char_code_n |
Either a Number value identifying a character set, or a constant. The following table shows valid values. You can specify either a character code numeric value or a constant: |
| Numeric Value | Constant | Character Set |
|---|---|---|
|
0 |
%CharType_AlphaNumeric |
Alphanumeric (7-bit ASCII codes; A-Z, a-z, 1-9, punctuation) |
|
1 |
%CharType_ExtendedLatin1 |
Extended Latin-1 characters (ISO8859-1 accents for Spanish, French, etc.) |
|
2 |
%CharType_HankakuKatakana |
Hankaku Katakana (single-byte Japanese Katakana) |
|
3 |
%CharType_ZenkakuKatakana |
Zenkaku Katakana (double-byte Japanese Katakana) |
|
4 |
%CharType_Hiragana |
Hiragana (Japanese) |
|
5 |
%CharType_Kanji |
Kanji (Japanese) |
|
6 |
%CharType_DBAlphaNumeric |
Double-byte Alphanumeric (Japanese) |
|
7,8,9 |
|
Reserved for future use |
|
10 |
%CharType_JapanesePunctuation |
Japanese punctuation |
Returns
ContainsOnlyCharType returns one of the following Number values. You can check for the constant instead of the numeric value, if you prefer:
| Numeric Value | Constant Value | Description |
|---|---|---|
|
1 |
%CharType_Matched |
String contains only characters belonging to the sets listed in char_code_list. |
|
0 |
%CharType_NotMatched |
String contains one or more characters that do not belong to sets listed in char_code_list. |
|
-1 |
%CharType_Unknown |
UNKNOWN: unable to determine whether character is of set char_code. This occurs if the character being checked is an unallocated Unicode codepoint, or was added in a version of Unicode greater than that supported by PeopleTools. |
Note:
If any character in the string is determined to be UNKNOWN, the return value is UNKNOWN.
Example
This example tests to see is the string is only Hiragana or Punctuation:
&ONLYHIRAGANA = ContainsOnlyCharType(&STRTOTEST, 4, 10);
If &ONLYHIRAGANA = 1 Then
WinMessage("There are only Hiragana and Punctuation characters");
Else
If &ONLYHIRAGANA = 0 Then
WinMessage("Mixed characters");
Else
WinMessage("UNKNOWN");
End-If
End-If