PB入门教程A
a$ = MID$ ("PowerBASIC", 4) ' returns "erBASIC" a$ = MID$ ("PowerBASIC", 4, 20) ' returns "erBASIC" a$ = MID$ ("PowerBASIC", 20) ' returns a null string a$ = MID$ ("1234567890",3,-4) ' returns "345678"
UCASE$ 函数
用途:返回文本的大写字母。 语法:s$ = UCASE$ (string_expression) 备注:
FORMAT$ 函数
用途: 返回格式化文本。
语法: x$ = FORMAT$ (num_expression [, [digits& | fmt$]]) 备注:
A$ = FORMAT$< /FONT > (123456, "00\:00\:00") ' 12:34:56
USING$ 函数
用途:返回格式化文本。
语法:sResult$ = USING$(fmtmask$掩码, expr表达式 [, expr [, ...]]) 备注:a$ = USING$ ("!", "abc") ' returns "a"
a$ = USING$ ("You owe $$#,.##", 12345.67@)' returns "You owe DIM p AS BYTE PTR
HOST ADDR "localhost" TO ip& p = VARPTR(ip&)
a$ = USING$ ("#_.#_.#_.#", @p, @p[1], @p[2], @p[3])' returns a$ = USING$ ("&=#.##############", "Pi", ATN(1)*4)' returns a$ = USING$ ("!", "AX", "BX", "CX")' returns "ABC" a$ a$
= =
USING$ USING$
("$#.##_,",
1,20,300,4)'
returns returns
$12,345.67
x$ = UCASE$ ("Beware of cats!") Result BEWARE OF CATS!
"127.0.0.1"
"Pi=3.14159265358979"
"$1.00,$20.00,$300.00,$4.00,"
("$*=#####.##_,",1,20)'
"$======1.00,$=====20.00,"