✨ feat(tsl-api-reference): expand API and module coverage
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
|
||||
提供字符串集合存储、查找、排序和名称值管理能力的内置对象
|
||||
|
||||
<!-- tags: Object TStringList 字符串列表 排序 sort 查找 搜索 lookup 数组 列表 array list -->
|
||||
<!-- tags: Object TStringList 字符串列表 排序 sort 查找 搜索 lookup 数组 列表 array list 创建 生成 构造函数 实例化 new -->
|
||||
|
||||
### `create()`
|
||||
|
||||
声明:function
|
||||
|
||||
创建 TStringList 实例
|
||||
无参数构造函数。创建空的 TStringList 实例
|
||||
|
||||
<!-- tags: Object TStringList 字符串列表 创建 生成 数组 列表 array list 字符串 文本 string -->
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,添加的字符串 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---- | ------ | ------------------------ |
|
||||
| `s` | string | 字符串类型,添加的字符串 |
|
||||
|
||||
返回:integer
|
||||
|
||||
@@ -61,8 +61,8 @@ return r;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --------- | ----------- | ----------------------------------- |
|
||||
| `strings` | TStringList | TStringList或者其他TStrings派生类型 |
|
||||
|
||||
返回:any
|
||||
@@ -70,12 +70,13 @@ return r;
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
bj:=CreateObject('TStringList');
|
||||
obj.CommaText:='A=ABC,B=123,C=abc';
|
||||
obj2:=CreateObject('TStringList');
|
||||
obj2.CommaText:='A=DDD,G=666';
|
||||
obj := CreateObject("TStringList");
|
||||
obj.CommaText := "A=ABC,B=123,C=abc";
|
||||
obj2 := CreateObject("TStringList");
|
||||
obj2.CommaText := "A=DDD,G=666";
|
||||
obj.AddStrings(obj2);
|
||||
return obj.CommaText;
|
||||
// 输出:A=ABC,B=123,C=abc,A=DDD,G=666
|
||||
```
|
||||
|
||||
### `append(s)`
|
||||
@@ -88,9 +89,9 @@ return obj.CommaText;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,添加的字符串 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---- | ------ | ------------------------ |
|
||||
| `s` | string | 字符串类型,添加的字符串 |
|
||||
|
||||
返回:any
|
||||
|
||||
@@ -104,8 +105,8 @@ return obj.CommaText;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----- | ----------- | --------------------------------------------- |
|
||||
| `src` | TStringList | TStringList或者其他TStrings派生类型,复制的源 |
|
||||
|
||||
返回:any
|
||||
@@ -144,8 +145,8 @@ return array(obj2.Delimiter,obj2.DelimitedText);
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | ------- | ---------------------- |
|
||||
| `index` | integer | 整数类型,删除的索引号 |
|
||||
|
||||
返回:any
|
||||
@@ -160,8 +161,8 @@ return array(obj2.Delimiter,obj2.DelimitedText);
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----- | ----------- | ----------------------------------------------- |
|
||||
| `src` | TStringList | TStringList或者其他TStrings派生类型,比较的对象 |
|
||||
|
||||
返回:any
|
||||
@@ -176,8 +177,8 @@ return array(obj2.Delimiter,obj2.DelimitedText);
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| -------- | ------- | --------------------- |
|
||||
| `index1` | integer | 整数类型,互换的位置1 |
|
||||
| `index2` | integer | 整数类型,互换的位置2 |
|
||||
|
||||
@@ -202,9 +203,9 @@ return obj.CommaText;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,查找的字符串 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | ------- | ---------------------------- |
|
||||
| `s` | string | 字符串类型,查找的字符串 |
|
||||
| `index` | integer | 整数类型。返回查找到的索引号 |
|
||||
|
||||
返回:boolean
|
||||
@@ -230,9 +231,9 @@ else return '查找失败';
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,查找的字符串 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---- | ------ | ------------------------ |
|
||||
| `s` | string | 字符串类型,查找的字符串 |
|
||||
|
||||
返回:integer
|
||||
|
||||
@@ -246,8 +247,8 @@ else return '查找失败';
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------ | ------ | ------------------------------------------------ |
|
||||
| `name` | string | 字符串类型,查找的Name=Value中的Name所在的索引号 |
|
||||
|
||||
返回:integer
|
||||
@@ -262,10 +263,10 @@ else return '查找失败';
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | integer | 整数类型,插入的位置 |
|
||||
| `s` | string | 字符串类型,插入的字符串 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | ------- | ------------------------ |
|
||||
| `index` | integer | 整数类型,插入的位置 |
|
||||
| `s` | string | 字符串类型,插入的字符串 |
|
||||
|
||||
返回:any
|
||||
|
||||
@@ -279,9 +280,9 @@ else return '查找失败';
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `alias` | string | 字符串类型,目录别名。如果有系统权限,可以为空字符串 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----------- | ------ | ------------------------------------------------------- |
|
||||
| `alias` | string | 字符串类型,目录别名。如果有系统权限,可以为空字符串 |
|
||||
| `file_name` | string | 字符串类型,文件名,如果Alias为空,则为带全路径的文件名 |
|
||||
|
||||
返回:any
|
||||
@@ -305,8 +306,8 @@ return obj.CommaText;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| -------- | ------- | -------------------------- |
|
||||
| `stream` | TStream | 流类型,如文件流,内存流等 |
|
||||
|
||||
返回:any
|
||||
@@ -332,10 +333,10 @@ return obj.CommaText;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----------- | ------- | ---------------------------------- |
|
||||
| `cur_index` | integer | 整数类型,需要移动的内容的原始位置 |
|
||||
| `new_index` | integer | 整数类型,移动到的新位置索引 |
|
||||
| `new_index` | integer | 整数类型,移动到的新位置索引 |
|
||||
|
||||
返回:any
|
||||
|
||||
@@ -349,9 +350,9 @@ return obj.CommaText;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | ---- | ----- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
@@ -365,9 +366,9 @@ return obj.CommaText;
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `alias` | string | 字符串类型,目录别名。如果有系统权限,可以为空字符串 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----------- | ------ | ------------------------------------------------------- |
|
||||
| `alias` | string | 字符串类型,目录别名。如果有系统权限,可以为空字符串 |
|
||||
| `file_name` | string | 字符串类型,文件名,如果Alias为空,则为带全路径的文件名 |
|
||||
|
||||
返回:any
|
||||
@@ -375,10 +376,15 @@ return obj.CommaText;
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
pathname:= "E:\\Test\\Case-save.txt";
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Text:=TestStr1();
|
||||
obj.SaveToFile('',pathName);
|
||||
path_name := "tstringlist-save-example.txt";
|
||||
obj := CreateObject("TStringList");
|
||||
obj.Text := %%text
|
||||
first line
|
||||
second line%%text;
|
||||
obj.SaveToFile("", path_name);
|
||||
echo fileExists("", path_name), "\n";
|
||||
fileDelete("", path_name);
|
||||
// 输出:1
|
||||
```
|
||||
|
||||
### `saveToStream(stream)`
|
||||
@@ -391,8 +397,8 @@ obj.SaveToFile('',pathName);
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| -------- | ------- | -------------------------- |
|
||||
| `stream` | TStream | 流类型,如文件流,内存流等 |
|
||||
|
||||
返回:any
|
||||
@@ -421,8 +427,8 @@ return ws.size; //返回20
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------ | ------ | ---------------------- |
|
||||
| `text` | string | 字符串类型,设置的内容 |
|
||||
|
||||
返回:any
|
||||
@@ -449,9 +455,9 @@ return ws.size; //返回20
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | ---- | ----- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
@@ -474,9 +480,9 @@ return obj.strings(1); //读
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | ---- | ----- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
@@ -490,9 +496,9 @@ return obj.strings(1); //读
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | ---- | ----- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
@@ -517,9 +523,9 @@ return array(s0,obj.DelimitedText);
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `name` | any | name |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------ | ---- | ---- |
|
||||
| `name` | any | name |
|
||||
|
||||
返回:string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user