udfIsHexDigit
bln udfIsHexDigit (str, int)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfIsHexDigit (strString, intPos)
If intPos < 1 Then Return @FALSE
If intPos > StrLen (strString) Then Return @FALSE
Return !!StrIndexNC ("0123456789ABCDEF", StrSub (strString, intPos, 1), 1, @FWDSCAN)
;..........................................................................................................................................
; This UDF "udfIsHexDigit" returns a boolean value, which indicates if
; the character in the given strString at position intPos is a hexadecimal digit or not.
; (c)Detlev Dalitz.20100109.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------

; Test.

blnIsHexDigit101 = udfIsHexDigit ("0123456789ABCDEF", 01) ; 1 = @TRUE
blnIsHexDigit102 = udfIsHexDigit ("0123456789ABCDEF", 02) ; 1 = @TRUE
blnIsHexDigit103 = udfIsHexDigit ("0123456789ABCDEF", 03) ; 1 = @TRUE
blnIsHexDigit104 = udfIsHexDigit ("0123456789ABCDEF", 04) ; 1 = @TRUE
blnIsHexDigit105 = udfIsHexDigit ("0123456789ABCDEF", 05) ; 1 = @TRUE
blnIsHexDigit106 = udfIsHexDigit ("0123456789ABCDEF", 06) ; 1 = @TRUE
blnIsHexDigit107 = udfIsHexDigit ("0123456789ABCDEF", 07) ; 1 = @TRUE
blnIsHexDigit108 = udfIsHexDigit ("0123456789ABCDEF", 08) ; 1 = @TRUE
blnIsHexDigit109 = udfIsHexDigit ("0123456789ABCDEF", 09) ; 1 = @TRUE
blnIsHexDigit110 = udfIsHexDigit ("0123456789ABCDEF", 10) ; 1 = @TRUE
blnIsHexDigit111 = udfIsHexDigit ("0123456789ABCDEF", 11) ; 1 = @TRUE
blnIsHexDigit112 = udfIsHexDigit ("0123456789ABCDEF", 12) ; 1 = @TRUE
blnIsHexDigit113 = udfIsHexDigit ("0123456789ABCDEF", 13) ; 1 = @TRUE
blnIsHexDigit114 = udfIsHexDigit ("0123456789ABCDEF", 14) ; 1 = @TRUE
blnIsHexDigit115 = udfIsHexDigit ("0123456789ABCDEF", 15) ; 1 = @TRUE
blnIsHexDigit116 = udfIsHexDigit ("0123456789ABCDEF", 16) ; 1 = @TRUE

blnIsHexDigit121 = udfIsHexDigit ("abcdef", 1) ; 1 = @TRUE
blnIsHexDigit122 = udfIsHexDigit ("abcdef", 2) ; 1 = @TRUE
blnIsHexDigit123 = udfIsHexDigit ("abcdef", 3) ; 1 = @TRUE
blnIsHexDigit124 = udfIsHexDigit ("abcdef", 4) ; 1 = @TRUE
blnIsHexDigit125 = udfIsHexDigit ("abcdef", 5) ; 1 = @TRUE
blnIsHexDigit126 = udfIsHexDigit ("abcdef", 6) ; 1 = @TRUE

blnIsHexDigit131 = udfIsHexDigit ("g", 1) ; 0 = @FALSE.
blnIsHexDigit132 = udfIsHexDigit ("Z", 1) ; 0 = @FALSE.
blnIsHexDigit133 = udfIsHexDigit ("+", 1) ; 0 = @FALSE.



; Method 2.
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfIsHexDigit_ (strString, intPos)
If intPos < 1 Then Return @FALSE
If intPos > StrLen (strString) Then Return @FALSE
intNum = Char2Num (StrSub (strString, intPos, 1))
arrTab = Arrayize ("0,67043328,126,126,0,0,0,0", ",")
Return !!(arrTab[intNum >> 5] & (1 << (intNum & 31)))
;..........................................................................................................................................
; This UDF "udfIsHexDigit" returns a boolean value, which indicates if
; the character in the given strString at position intPos is a hexadecimal digit or not.
; (c)Detlev Dalitz.20100109.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------

; Test.

blnIsHexDigit201 = udfIsHexDigit ("0123456789ABCDEF", 01) ; 1 = @TRUE
blnIsHexDigit202 = udfIsHexDigit ("0123456789ABCDEF", 02) ; 1 = @TRUE
blnIsHexDigit203 = udfIsHexDigit ("0123456789ABCDEF", 03) ; 1 = @TRUE
blnIsHexDigit204 = udfIsHexDigit ("0123456789ABCDEF", 04) ; 1 = @TRUE
blnIsHexDigit205 = udfIsHexDigit ("0123456789ABCDEF", 05) ; 1 = @TRUE
blnIsHexDigit206 = udfIsHexDigit ("0123456789ABCDEF", 06) ; 1 = @TRUE
blnIsHexDigit207 = udfIsHexDigit ("0123456789ABCDEF", 07) ; 1 = @TRUE
blnIsHexDigit208 = udfIsHexDigit ("0123456789ABCDEF", 08) ; 1 = @TRUE
blnIsHexDigit209 = udfIsHexDigit ("0123456789ABCDEF", 09) ; 1 = @TRUE
blnIsHexDigit210 = udfIsHexDigit ("0123456789ABCDEF", 10) ; 1 = @TRUE
blnIsHexDigit211 = udfIsHexDigit ("0123456789ABCDEF", 11) ; 1 = @TRUE
blnIsHexDigit212 = udfIsHexDigit ("0123456789ABCDEF", 12) ; 1 = @TRUE
blnIsHexDigit213 = udfIsHexDigit ("0123456789ABCDEF", 13) ; 1 = @TRUE
blnIsHexDigit214 = udfIsHexDigit ("0123456789ABCDEF", 14) ; 1 = @TRUE
blnIsHexDigit215 = udfIsHexDigit ("0123456789ABCDEF", 15) ; 1 = @TRUE
blnIsHexDigit216 = udfIsHexDigit ("0123456789ABCDEF", 16) ; 1 = @TRUE

blnIsHexDigit221 = udfIsHexDigit ("abcdef", 1) ; 1 = @TRUE
blnIsHexDigit222 = udfIsHexDigit ("abcdef", 2) ; 1 = @TRUE
blnIsHexDigit223 = udfIsHexDigit ("abcdef", 3) ; 1 = @TRUE
blnIsHexDigit224 = udfIsHexDigit ("abcdef", 4) ; 1 = @TRUE
blnIsHexDigit225 = udfIsHexDigit ("abcdef", 5) ; 1 = @TRUE
blnIsHexDigit226 = udfIsHexDigit ("abcdef", 6) ; 1 = @TRUE

blnIsHexDigit231 = udfIsHexDigit ("g", 1) ; 0 = @FALSE.
blnIsHexDigit232 = udfIsHexDigit ("Z", 1) ; 0 = @FALSE.
blnIsHexDigit233 = udfIsHexDigit ("+", 1) ; 0 = @FALSE.

Exit