StringIsXDigit

首页  后退  前进

StringIsXDigit
down2

StringIsXDigit

检查字符串是否仅包含十六进制数字字符 (0-9, A-F).

 

StringIsXDigit ( "string" )

参数

string

目标字符串

返回值

成功:

返回 1.

失败:

返回 0, 字符串中含有非十六进制字符.

备注

有效的十六进制字符包括 0123456789abcdefABCDEF

请注意, 空白或 "0x" 前缀将导致 StringIsXDigit() 返回 0.

 

函数示例

#include <MsgBoxConstants.au3>
MsgBox($MB_SYSTEMMODAL, "", "Is the string 42 a hexadecimal digit: " & StringIsXDigit("42") & @CRLF & _ ; Returns 1, as the string contains only hexadecimal (0-9, A-F) characters.
        "Is the string 00 a hexadecimal digit: " & StringIsXDigit("00") & @CRLF & _ ; Returns 1, as the string contains only hexadecimal (0-9, A-F) characters.
        "Is the string 1.0 a hexadecimal digit: " & StringIsXDigit("1.0") & @CRLF & _ ; Returns 0, due to the decimal point.
        "Is the number 1.0 a hexadecimal digit: " & StringIsXDigit(1.0) & @CRLF & _ ; Returns 1, due to the number to string conversion.
        "Is the string 'A string' a hexadecimal digit: " & StringIsXDigit("A string.") & @CRLF) ; Returns 0, due to the string containing whitespace.

----------------------------------------

 

该函数可以通过命令 exect 调用

参见:

StringIsDigit, StringIsAlNum, StringIsAlpha, StringIsASCII

例子
copy
StringIsXDigit('00FC') ;; 返回1

StringIsXDigit('2570') ;; 返回1

StringIsXDigit('0x2570') ;; 由于x而返回0

StringIsXDigit('a~~cafe') ;; 由于空格a返回0

StringIsXDigit(1+2.0) ;; 由于将数字转换为字符串,因此返回1

StringIsXDigit(0x2570) ;; 由于将数字转换为字符串,因此返回1

 

exect=$var_i1=StringIsXDigit('00FC')||$var_i2=StringIsXDigit('0x2570') GLOBALEXECT<a> ;; 检查只有十六进制数字(0-9,A-F)的字符串中的存在

up2

tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru