
Gets character-type information for a string, or information for a character-type.
StrTypeInfo( string, flag)
(s) string a character or a string.
(i) flag a flag specifying the information to retrieve (see below).
(i/s) depends on the flag specified. See below.
If "flag" = 0 or 1, "value" specifies a string of 1 or more characters. For each character in the string, a character-type is determined. The character-type is comprised of one or more of the following values, combined using the bitwise OR ('|') operator:
|
Value |
Name |
Meaning |
|
1 |
C1_UPPER |
Uppercase |
|
2 |
C1_LOWER |
Lowercase |
|
4 |
C1_DIGIT |
Decimal digits |
|
8 |
C1_SPACE |
Space characters |
|
16 |
C1_PUNCT |
Punctuation |
|
32 |
C1_CNTRL |
Control characters |
|
64 |
C1_BLANK |
Blank characters |
|
128 |
C1_XDIGIT |
Hexadecimal digits |
|
256 |
C1_ALPHA |
Any linguistic character: alphabetical, syllabary, or ideographic |
|
512 |
C1_DEFINED |
A defined character (not used in Windows 95/98/ME ) |
If "flag" = 0, the function returns a value comprised of the character-types of all the characters in the string, combined using the bitwise AND ('&') operator.
If "flag" = 1, the function returns a value comprised of the character-types of all the characters in the string, combined using the bitwise OR ('|') operator.
If "flag" = -1, "value" specifies a character-type, and the function returns a string describing the bits that make up the character-type. The string is comprised of a space-delimited list of words, with one word describing each bit contained within the character-type:
|
Value |
Name |
Word in string |
|
1 |
C1_UPPER |
"Upper" |
|
2 |
C1_LOWER |
"Lower" |
|
4 |
C1_DIGIT |
"Digit" |
|
8 |
C1_SPACE |
"Space" |
|
16 |
C1_PUNCT |
"Punct" |
|
32 |
C1_CNTRL |
"Cntrl" |
|
64 |
C1_BLANK |
"Blank" |
|
128 |
C1_XDIGIT |
"HexDg" |
|
256 |
C1_ALPHA |
"Alpha" |
|
512 |
C1_DEFINED |
"Undef" if the C1_DEFINED bit is NOT set (not used in Windows 95/98/ME ) |
String parameters and return values are ANSI in Windows 95/98/ME, and Unicode in Windows NT/2000/XP/2003/Vista/2008/7.
str= "!@#abcxyz123%@CRLF%111%@TAB%"
While @TRUE
str = AskLine( "Test", "Enter Something", str )
typeAND = StrTypeInfo( str, 0 )
typeOR = StrTypeInfo( str, 1)
dalen = StrLen( str)
allinfo = ""
If typeAND==0
allinfo = StrCat(allinfo,"No defined characters found",@CRLF,@CRLF)
Else
If typeAND==512
allinfo= StrCat(allinfo,"No common type matches found in string",@CRLF,@CRLF)
Else
allinfo= StrCat(allinfo,"Entire string is :",@CRLF,StrTypeInfo(typeAND,-1),@CRLF,@CRLF)
EndIf
EndIf
allinfo= StrCat(allInfo,"String contains :",@CRLF,StrTypeInfo(typeOR,-1),@CRLF,@CRLF)
; Loop once for each character
For index = 1 To dalen
char = StrSub( str, index, 1 )
typeinf = StrTypeInfo(StrTypeInfo(char,0),-1)
allinfo = StrCat(allinfo,char," : ",typeinf,@CRLF)
Next
Pause(str,allinfo)
EndWhile
Exit