📝 docs(tsl): rebuild canonical syntax and routing manual
This commit is contained in:
@@ -0,0 +1,209 @@
|
||||
#### 信息摘要及编码
|
||||
|
||||
##### 内容
|
||||
|
||||
- 信息摘要函数
|
||||
- BASE64编码
|
||||
- URI EnCode函数
|
||||
- 进制编码函数
|
||||
|
||||
##### 信息摘要函数
|
||||
|
||||
信息摘要函数主要提供CRC32,MD5,SHA这三类信息摘要算法的实现,信息摘要算法广泛地应用于数字签名应用中。
|
||||
|
||||
###### 内容
|
||||
|
||||
- 摘要函数使用说明
|
||||
- GetMsgDigest
|
||||
- GetMsgDigest(文件)
|
||||
|
||||
###### 摘要函数使用说明
|
||||
|
||||
```tsl
|
||||
filename := "d:\\test.txt";
|
||||
teststr := "hello";
|
||||
alias := ""; //别名
|
||||
return array(
|
||||
"filename":filename,
|
||||
"GetMsgDigest(crc32_str)":GetMsgDigest(teststr,0),
|
||||
"GetMsgDigest(md5_str)":GetMsgDigest(teststr,1),
|
||||
"GetMsgDigest(sha1_str)":GetMsgDigest(teststr,2),
|
||||
"GetMsgDigest(sha224_str)":GetMsgDigest(teststr,3),
|
||||
"GetMsgDigest(sha256_str)":GetMsgDigest(teststr,4),
|
||||
"GetMsgDigest(sha384_str)":GetMsgDigest(teststr,5),
|
||||
"GetMsgDigest(sha512_str)":GetMsgDigest(teststr,6),
|
||||
"GetMsgDigest(alias, filename, crc32_str)":GetMsgDigest(alias,filename,0),
|
||||
"GetMsgDigest(alias, filename, md5_str)":GetMsgDigest(alias,filename,1),
|
||||
"GetMsgDigest(alias, filename, sha1_str)":GetMsgDigest(alias,filename,2),
|
||||
"GetMsgDigest(alias, filename, sha224_str)":GetMsgDigest(alias,filename,3),
|
||||
"GetMsgDigest(alias, filename, sha256_str)":GetMsgDigest(alias,filename,4),
|
||||
"GetMsgDigest(alias, filename, sha384_str)":GetMsgDigest(alias,filename,5),
|
||||
"GetMsgDigest(alias, filename, sha512_str)":GetMsgDigest(alias,filename,6)
|
||||
);
|
||||
```
|
||||
|
||||
###### GetMsgDigest
|
||||
|
||||
用途:信息摘要函数相关函数。
|
||||
参数:arg1(按示例顺序传入)。
|
||||
返回:处理后的结果值。
|
||||
|
||||
- 摘要函数使用说明
|
||||
- GetMsgDigest
|
||||
- GetMsgDigest(文件)
|
||||
|
||||
###### GetMsgDigest(文件)
|
||||
|
||||
##### BASE64编码
|
||||
|
||||
字符串与BASE64编码的互转函数
|
||||
|
||||
###### 内容
|
||||
|
||||
- BASE64编码函数使用说明
|
||||
- StrToBase64
|
||||
- Base64ToStr
|
||||
|
||||
###### BASE64编码函数使用说明
|
||||
|
||||
```tsl
|
||||
//常量定义
|
||||
test_str := 'hello world';
|
||||
//BASE64
|
||||
base64 := StrToBase64(test_str); //转换为BASE64编码
|
||||
orig_str := Base64ToStr(base64); //BASE64编码转换为字符串
|
||||
```
|
||||
|
||||
###### StrToBase64
|
||||
|
||||
用途:将字符串转换为对应类型。
|
||||
参数:arg1(按示例顺序传入)。
|
||||
返回:转换后的数值或日期。
|
||||
|
||||
范例
|
||||
|
||||
```tsl
|
||||
return rdo2 StrToBase64('a12'); // 返回字符串:YTEy
|
||||
```
|
||||
|
||||
###### Base64ToStr
|
||||
|
||||
用途:将输入值转换为字符串。
|
||||
参数:arg1(按示例顺序传入)。
|
||||
返回:字符串。
|
||||
|
||||
范例
|
||||
|
||||
```tsl
|
||||
return rdo2 Base64ToStr('YTEy'); // 返回字符串:a12
|
||||
```
|
||||
|
||||
##### URI EnCode函数
|
||||
|
||||
与JavaScript同名函数功能完全相同。
|
||||
|
||||
###### 内容
|
||||
|
||||
- EncodeURIComponent
|
||||
- DecodeURIComponent
|
||||
- EncodeURI
|
||||
- DecodeURI
|
||||
|
||||
###### EncodeURIComponent
|
||||
|
||||
###### DecodeURIComponent
|
||||
|
||||
###### EncodeURI
|
||||
|
||||
###### DecodeURI
|
||||
|
||||
##### 进制编码函数
|
||||
|
||||
###### 内容
|
||||
|
||||
- 进制编码函数使用说明
|
||||
- EncodeRadixstr
|
||||
- DecodeRadixstr
|
||||
- Decoderadixwstr
|
||||
- Encoderadixwstr
|
||||
|
||||
###### 进制编码函数使用说明
|
||||
|
||||
encoderadixstr("123","0x",16)结果为"0x310x320x33" 前缀
|
||||
|
||||
encoderadixstr("123","h",0x80000000+16)结果为"31h32h33h" 后缀
|
||||
|
||||
decoderadixstr("0x310x320x33",2,16)的结果为123
|
||||
|
||||
encoderadixstr("123","h",0x80000000+16)结果为"31h32h33h"
|
||||
|
||||
decoderadixstr("31h32h33h",1,0x80000000+16)结果为"123"
|
||||
|
||||
encoderadixstr("天软","0x",16)结果为"0xCC0xEC0xC80xED" 默认大写
|
||||
|
||||
encoderadixstr("天软","0x",0x40000000+16)结果为"0xcc0xec0xc80xed" 小写字母
|
||||
|
||||
###### EncodeRadixstr
|
||||
|
||||
用途:进制编码函数相关函数。
|
||||
参数:arg1,arg2,arg3(按示例顺序传入)。
|
||||
返回:处理后的结果值。
|
||||
|
||||
范例
|
||||
|
||||
```tsl
|
||||
return EncodeRadixstr("1122", "0x", 16); // 结果为’ 0x310x310x320x32’,前缀,16进制
|
||||
return EncodeRadixstr("1122", "h", 0x80000000 + 16); // ’ 31h31h32h32h’,后缀,16进制
|
||||
return EncodeRadixstr("天软", "ox", 0x80000000 + 16);
|
||||
// ’ CCoxECoxC8oxEDox’,后缀,默认为大写字母,16进制
|
||||
return EncodeRadixstr("天软", "0X", 0x80000000 + 0x40000000 + 16);
|
||||
// ’ cc0Xec0Xc80Xed0X’,后缀,小写字母,16进制
|
||||
return EncodeRadixstr("18", "B", 2); // ’ B00110001B00111000’,二进制
|
||||
```
|
||||
|
||||
###### DecodeRadixstr
|
||||
|
||||
用途:进制编码函数相关函数。
|
||||
参数:arg1,arg2,arg3(按示例顺序传入)。
|
||||
返回:处理后的结果值。
|
||||
|
||||
范例
|
||||
|
||||
```tsl
|
||||
return DecodeRadixstr('0x310x310x320x32', 2, 16); // 返回'1122'
|
||||
// 注:这里的第二个参数是前缀或后缀的串的长度,并非指定串
|
||||
```
|
||||
|
||||
###### Decoderadixwstr
|
||||
|
||||
用途:进制编码函数相关函数。
|
||||
参数:arg1,arg2,arg3(按示例顺序传入)。
|
||||
返回:处理后的结果值。
|
||||
|
||||
范例
|
||||
|
||||
```tsl
|
||||
return Decoderadixwstr('0x00310x00310x00320x0032', 2, 16); // 返回'1122'
|
||||
// 注:这里的第二个参数是前缀或后缀的串的长度,并非指定串
|
||||
```
|
||||
|
||||
###### Encoderadixwstr
|
||||
|
||||
用途:进制编码函数相关函数。
|
||||
参数:arg1,arg2,arg3(按示例顺序传入)。
|
||||
返回:处理后的结果值。
|
||||
|
||||
范例
|
||||
|
||||
```tsl
|
||||
return Encoderadixwstr("1122", "0x", 16);
|
||||
// 结果为'0x00310x00310x00320x0032',前缀,16进制
|
||||
return Encoderadixwstr("1122", "h", 0x80000000 + 16);
|
||||
// '0031h0031h0032h0032h',后缀,16进制
|
||||
return Encoderadixwstr("天软", "ox", 0x80000000 + 16); // ''
|
||||
// '5929ox8F6Fox',后缀,默认为大写字母,16进制
|
||||
return Encoderadixwstr("天软", "0X", 0x80000000 + 0x40000000 + 16);
|
||||
// '59290X8f6f0X',后缀,小写字母,16进制
|
||||
return Encoderadixwstr("18", "B", 2);
|
||||
// 'B0000000000110001B0000000000111000',二进制
|
||||
```
|
||||
Reference in New Issue
Block a user