✨ feat(tsl-api-reference): expand and reorganize api catalog
Flatten builtin pages, add third-party and platform scopes, and import financial and data warehouse references. Keep the existing generated index without rebuilding after signature normalization.
This commit is contained in:
@@ -0,0 +1,668 @@
|
||||
# Object - TStringList 字符串列表
|
||||
|
||||
## `TStringList`
|
||||
|
||||
声明:class
|
||||
|
||||
TStringList 内置对象
|
||||
|
||||
### `create()`
|
||||
|
||||
声明:function
|
||||
|
||||
创建 TStringList 实例
|
||||
|
||||
可见性:public
|
||||
|
||||
### `add(s)`
|
||||
|
||||
声明:function
|
||||
|
||||
添加字符串
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,添加的字符串 |
|
||||
|
||||
返回:integer
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.CommaText:='A=ABC,B=123,C=abc';
|
||||
index:=obj.Add("X=DDD");
|
||||
echo index;
|
||||
sN:=obj.count;
|
||||
r:=array();
|
||||
for i:=0 to SN-1 do
|
||||
begin
|
||||
r[i,'n']:=obj.Names(i);
|
||||
r[i,'v']:=obj.values(obj.Names(i));
|
||||
end
|
||||
return r;
|
||||
```
|
||||
|
||||
### `addStrings(strings)`
|
||||
|
||||
声明:function
|
||||
|
||||
将Strings里的字符串批量添加
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `strings` | TStringList | TStringList或者其他TStrings派生类型 |
|
||||
|
||||
返回:any
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
bj:=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;
|
||||
```
|
||||
|
||||
### `append(s)`
|
||||
|
||||
声明:function
|
||||
|
||||
添加字符串,与Add相同,但不返回索引号
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,添加的字符串 |
|
||||
|
||||
返回:any
|
||||
|
||||
### `assign(src)`
|
||||
|
||||
声明:function
|
||||
|
||||
将内容复制成和src里的内容一样
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `src` | TStringList | TStringList或者其他TStrings派生类型,复制的源 |
|
||||
|
||||
返回:any
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Delimiter:=";";
|
||||
obj.DelimitedText:='A=DDD;G=666';
|
||||
obj2:=CreateObject('TStringList');
|
||||
obj2.Delimiter:=",";
|
||||
obj2.Assign(obj);//复制
|
||||
return array(obj2.Delimiter,obj2.DelimitedText);
|
||||
```
|
||||
|
||||
### `clear()`
|
||||
|
||||
声明:function
|
||||
|
||||
清除掉所有内容
|
||||
|
||||
可见性:public
|
||||
|
||||
返回:any
|
||||
|
||||
### `delete(index)`
|
||||
|
||||
声明:function
|
||||
|
||||
删除指定索引
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | integer | 整数类型,删除的索引号 |
|
||||
|
||||
返回:any
|
||||
|
||||
### `equals(src)`
|
||||
|
||||
声明:function
|
||||
|
||||
比较两个内容是否相同
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `src` | TStringList | TStringList或者其他TStrings派生类型,比较的对象 |
|
||||
|
||||
返回:any
|
||||
|
||||
### `exChange(index1, index2)`
|
||||
|
||||
声明:function
|
||||
|
||||
将两个位置的内容互相交换
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index1` | integer | 整数类型,互换的位置1 |
|
||||
| `index2` | integer | 整数类型,互换的位置2 |
|
||||
|
||||
返回:any
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.CommaText:='A=ABC,B=123,C=abc';
|
||||
obj.ExChange(0,2);
|
||||
return obj.CommaText;
|
||||
```
|
||||
|
||||
### `find(s, index)`
|
||||
|
||||
声明:function
|
||||
|
||||
查找字符串。仅对已经排序好的TStringlist有效,未排序的请用IndexOf
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,查找的字符串 |
|
||||
| `index` | integer | 整数类型。返回查找到的索引号 |
|
||||
|
||||
返回:boolean
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Sorted:=1;
|
||||
obj.CommaText:='C=456.,D=abc,A=ABC,E=666,F=A123,B=123';
|
||||
f:=obj.Find("E=666",Index);
|
||||
if f then return Index;
|
||||
else return '查找失败';
|
||||
```
|
||||
|
||||
### `indexOf(s)`
|
||||
|
||||
声明:function
|
||||
|
||||
返回字符串所在的索引号。查找与大小写敏感设置有关
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `s` | string | 字符串类型,查找的字符串 |
|
||||
|
||||
返回:integer
|
||||
|
||||
### `indexOfName(name)`
|
||||
|
||||
声明:function
|
||||
|
||||
返回Name键值所在的索引号
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `name` | string | 字符串类型,查找的Name=Value中的Name所在的索引号 |
|
||||
|
||||
返回:integer
|
||||
|
||||
### `insert(index, s)`
|
||||
|
||||
声明:function
|
||||
|
||||
插入字符串在指定索引号。仅未排序的场景适用,已排序的情况请用 Add
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | integer | 整数类型,插入的位置 |
|
||||
| `s` | string | 字符串类型,插入的字符串 |
|
||||
|
||||
返回:any
|
||||
|
||||
### `loadFromFile(alias, file_name)`
|
||||
|
||||
声明:function
|
||||
|
||||
从指定的文件中装载内容
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `alias` | string | 字符串类型,目录别名。如果有系统权限,可以为空字符串 |
|
||||
| `file_name` | string | 字符串类型,文件名,如果Alias为空,则为带全路径的文件名 |
|
||||
|
||||
返回:any
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
LJ:="E:\\Test\\Case-save.txt";
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.LoadFromFile('',LJ);
|
||||
return obj.CommaText;
|
||||
```
|
||||
|
||||
### `loadFromStream(stream)`
|
||||
|
||||
声明:function
|
||||
|
||||
从指定的流中装载内容
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `stream` | TStream | 流类型,如文件流,内存流等 |
|
||||
|
||||
返回:any
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
ws := new TMemoryStream();
|
||||
ws.write("A=aaa",5);
|
||||
ws.position:=0;
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.LoadFromStream(ws);
|
||||
return obj.CommaText;
|
||||
```
|
||||
|
||||
### `move(cur_index, new_index)`
|
||||
|
||||
声明:function
|
||||
|
||||
将指定位置的内容移动到新位置
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `cur_index` | integer | 整数类型,需要移动的内容的原始位置 |
|
||||
| `new_index` | integer | 整数类型,移动到的新位置索引 |
|
||||
|
||||
返回:any
|
||||
|
||||
### `names(index)`
|
||||
|
||||
声明:function
|
||||
|
||||
取第Index个Name=Value串的Name串。Index从0开始
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
### `saveToFile(alias, file_name)`
|
||||
|
||||
声明:function
|
||||
|
||||
将内容存贮到指定的文件中
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `alias` | string | 字符串类型,目录别名。如果有系统权限,可以为空字符串 |
|
||||
| `file_name` | string | 字符串类型,文件名,如果Alias为空,则为带全路径的文件名 |
|
||||
|
||||
返回:any
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
pathname:= "E:\\Test\\Case-save.txt";
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Text:=TestStr1();
|
||||
obj.SaveToFile('',pathName);
|
||||
```
|
||||
|
||||
### `saveToStream(stream)`
|
||||
|
||||
声明:function
|
||||
|
||||
将内容保存到指定的流中
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `stream` | TStream | 流类型,如文件流,内存流等 |
|
||||
|
||||
返回:any
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
ws := new TMemoryStream();
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Text:= 'A a
|
||||
B b
|
||||
C c
|
||||
D d
|
||||
';
|
||||
obj.SaveToStream(ws);
|
||||
return ws.size; //返回20
|
||||
```
|
||||
|
||||
### `setText(text)`
|
||||
|
||||
声明:function
|
||||
|
||||
设置text的内容,与设置属性Text的操作相同
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `text` | string | 字符串类型,设置的内容 |
|
||||
|
||||
返回:any
|
||||
|
||||
### `sort()`
|
||||
|
||||
声明:function
|
||||
|
||||
排序
|
||||
|
||||
可见性:public
|
||||
|
||||
返回:any
|
||||
|
||||
### `strings(index)`
|
||||
|
||||
声明:function
|
||||
|
||||
取或者设置指定索引的字符串。下标从0开始
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Delimiter:=";";
|
||||
obj.DelimitedText:='A=ABC;B=123;C=456.;D=abc';
|
||||
return obj.strings(1); //读
|
||||
```
|
||||
|
||||
### `stringsW(index)`
|
||||
|
||||
声明:function
|
||||
|
||||
取或者设置指定索引的字符串。功能同Strings,区别在于读取时StringsW返回的是宽字节字符串,而Strings返回的是多字节字符串
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
### `valueFromIndex(index)`
|
||||
|
||||
声明:function
|
||||
|
||||
读取或写入第Index个串的Value值。Index下标从0开始
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `index` | any | index |
|
||||
|
||||
返回:string
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Delimiter:=";";
|
||||
obj.DelimitedText:='A=ABC;B=123;C=456.;D=abc';
|
||||
s0:=obj.ValueFromIndex(1);//读取第1个
|
||||
obj.ValueFromIndex(1):="888"; //写入,即给指定位置的value重新赋值
|
||||
return array(s0,obj.DelimitedText);
|
||||
```
|
||||
|
||||
### `values(name)`
|
||||
|
||||
声明:function
|
||||
|
||||
设置或者取得Name=Value模式串中指定的Name的Value值
|
||||
|
||||
可见性:public
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `name` | any | name |
|
||||
|
||||
返回:string
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
obj:=CreateObject('TStringList');
|
||||
obj.Delimiter:=";";
|
||||
obj.DelimitedText:='A=ABC;B=123;C=456.;D=abc';
|
||||
SN:=obj.count;
|
||||
r:=array();
|
||||
for i:=0 to SN-1 do
|
||||
begin
|
||||
r[i,'name']:=obj.Names(i);//获取name值
|
||||
r[i,'value']:=obj.values(obj.Names(i));//获取指定name对应的value值
|
||||
end
|
||||
return r;
|
||||
```
|
||||
|
||||
### `Capacity`
|
||||
|
||||
声明:property
|
||||
|
||||
容量,如果已知需要的字符串比较多,预先设置容量会有比较好的性能
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:integer
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `CaseSensitive`
|
||||
|
||||
声明:property
|
||||
|
||||
大小写敏感,决定排序或者查找时是否大小写敏感。设置为真则表示大小写敏感,为假为大小写不敏感,默认为假
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:boolean
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `CommaText`
|
||||
|
||||
声明:property
|
||||
|
||||
逗号分割串。将每个字符串用,分割连接起来。若字符串中间有逗号,则在字符串两头加”号(注,单引号无效),若字符串中还包含”号,如字符串’ 3,a"bc’,则用'"3,a""bc"'表达
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `CommaTextW`
|
||||
|
||||
声明:property
|
||||
|
||||
功能同CommaText,区别是在读取时CommaTextW返回为宽字节字符串,而CommaText返回的是多字节字符串
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `Count`
|
||||
|
||||
声明:property
|
||||
|
||||
字符串个数
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:integer
|
||||
|
||||
访问:read
|
||||
|
||||
### `DelimitedText`
|
||||
|
||||
声明:property
|
||||
|
||||
用分割符连接起来的单个字符串。连接符用Delimiter属性指定,默认为逗号。而当字符串中存在连接符时,用QuoteChar加在字符串两端。当QuoteChar为”,且Delimiter为逗号时,DelimitedText的结果和CommaText一样
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `Delimiter`
|
||||
|
||||
声明:property
|
||||
|
||||
DelmitedText所依赖的连接符,默认为逗号
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `Duplicates`
|
||||
|
||||
声明:property
|
||||
|
||||
重复串时的行为控制,0:忽略重复串(默认值),1:允许重复串,2:重复串出错。排序时有效
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:integer
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `GetText`
|
||||
|
||||
声明:property
|
||||
|
||||
获取Text的值
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read
|
||||
|
||||
### `GetTextW`
|
||||
|
||||
声明:property
|
||||
|
||||
获取Text的值,并以宽字符串类型返回
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read
|
||||
|
||||
### `NameValueSeparator`
|
||||
|
||||
声明:property
|
||||
|
||||
Name,Value之间的间隔符,默认为=
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `QuoteChar`
|
||||
|
||||
声明:property
|
||||
|
||||
DelmitedText所依赖的引号符。一般在串中存在分割符时使用
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `Sorted`
|
||||
|
||||
声明:property
|
||||
|
||||
是否已经排序,设置为真则进行排序
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:boolean
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `Text`
|
||||
|
||||
声明:property
|
||||
|
||||
以回车换行分割每个字符串连接起来的单个串。如果存在包括回车换行的串,就会有混淆,如果要没有混淆,则需要用DelmitedText或者CommaText
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
|
||||
### `TextW`
|
||||
|
||||
声明:property
|
||||
|
||||
功能同Text,区别在于在读取时TextW返回为宽字节字符串,而Text返回的是多字节字符串
|
||||
|
||||
可见性:public
|
||||
|
||||
类型:string
|
||||
|
||||
访问:read/write
|
||||
Reference in New Issue
Block a user