PB入门教程A
一半,但仍提供相同数量的字符。要将 ANSI 字符串转换为 Unicode 字符串,请使用 UCODE$ 函数。
HEX$ 函数
用途:返回一个数值的十六进制文本。 语法:
VAL 函数
用途:从文本返回十进制数值。 语法:y = VAL (string_expression) 备注:
i& = VAL ("10.101e3") ' 10101 ~ 10.101*(10^3) j& = VAL ("2D4") ' 20000 ~ 2 * (10 ^ 4)
i& = VAL ("&HF5F3") ' Hex, returns -2573 (signed) j& = VAL ("&H0F5F3") ' Hex, returns 62963 (unsigned) x& = VAL ("&B0100101101") ' Binary, returns 301 (unsigned) y& = VAL ("&O4574514") ' Octal, returns 1243468 (signed) Price$ = "$ 15,345.92"
Cost@@ = VAL(REMOVE$(Price$, ANY "$, ")) Result 15345.92
a$ = HEX$ (65535) ' a$ will contain "FFFF" x& = VAL("&H" + a$) ' Signed result (-1) y& = VAL("&H0" + a$) ' Unsigned result (65535) DIM a AS DWORD, b AS STRING, c AS QUAD a = &H0FFFFFFFF ' Unsigned literal b = HEX$ (a) ' "FFFFFFFF" c = a ' 4294967295 b = HEX$ (c) ' "FFFFFFFF"
c = VAL("&H" + b) ' -1&& (signed conversion) b = HEX$ (c) ' "FFFFFFFF" c = VAL("&H0" + b) ' 4294967295&& b = HEX$ (c) ' "FFFFFFFF"
备注: