打印99乘法表 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 1*4=4 2*4=8 3*4=12 4*4=16 1*5=5 2*5=10 3*5=15 4*5=20 5*5=25 1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36 1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49 1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64 1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81 代码:var s: String; for var i := 1 to 9 do begin s := ''; for var j := 1 to i do s += Format('%d*%d=%d ', [j, i, i * j]); writeln(s+'<br>'); end; Trim(' 刘德华 ') or ' 刘德华 '.trim() [刘德华] UnicodeToAnsi('"abc\"\u6D4B\u8BD5\"123"') ==> "abc\"测试\"123" JSON.Parse('"abc\"\u6D4B\u8BD5\"123"') ==> abc"测试"123 FormatDatetime('yyyy-MM-dd hh:nn:ss.zzz',now); 2025-11-30 12:03:40.337 暂停1秒后输出 2025-11-30 12:03:41.357 存储、传输容量格式化 GB=1000M FormatCapacity(1024*1024*1024); ==> 1.07 GB 内存、文件容量格式化 GB=1024M,实际是GiB ByteSizeToStr(1024*1024*1024); ==> 1.00 GB 注意区分 GB 和 GiB,1GB=1000M 1GiB=1024M 大小写转换 s := 'Hello發iq!'; ASCIIUpperCase(s); ==> HELLO發IQ! AnsiUpperCase(s); ==> HELLO發IQ! ASCIILowerCase(s); ==> hello發iq! AnsiLowerCase(s); ==> hello發iq! s.UpperCase; ==> HELLO發IQ! s.ToUpper; ==> HELLO發IQ! s.LowerCase; ==> hello發iq! s.ToLower; ==> hello發iq! 字符串与数值转换 IntToStr(123); ==> 123 StrToInt('123'); ==> 123 '233'.ToInteger+1; ==> 234 StrToIntDef('', 456); ==> 456 StrToIntDef('A', 789); ==> 789 FloatToStr(123); ==> 123 StrToFloat('12.3'); ==> 12.3 '12.5'.ToFloat+1; ==> 13.5 StrToFloatDef('', 45.6); ==> 45.6 StrToFloatDef('A', 7.89); ==> 7.89 FormatFloat('#,##0.#0',12345.67); ==> 12,345.67 进制转换 UpperCase(IntToHex(123, 4)); ==> 007B HexToInt('007B'); ==> 123 IntToBin(0, 4); ==> 0000 IntToBin(5, 4); ==> 0101 IntToBin(555, 4); ==> 1000101011 IntToBin(-5, 4); ==> 1111111111111111111111111111111111111111111111111111111111111011 字符串转换 StrToHex('abc测试123'); ==> 616263e6b58be8af95313233 HexToStr('616263e6b58be8af95313233'); ==> abc测试123 字符串拆分 var b := 'test1'#13'test3'#13'test2';for var e in b.Split(#13) do println(e); ==> test1 test3 test2 字符串拼接 b.split(#13).join(','); ==> test1,test3,test2 字符串排序 b.split(#13).Sort.join(','); ==> test1,test2,test3 字符串截取 b.Left(5); ==> test1 b.Right(5); ==> test2 Copy(b,7,5); ==> test3 Log日志、try...finally...end、try...except...end等例子请直接查看脚本代码
var s: String; for var i := 1 to 9 do begin s := ''; for var j := 1 to i do s += Format('%d*%d=%d ', [j, i, i * j]); writeln(s+'<br>'); end;