Delphi中,根据字符串,拆分字符串,相当于vb中的split函数
来源:互联网 发布:淘宝网雪纺衫 编辑:程序博客网 时间:2024/05/21 15:13
//根据字符串,拆分字符串,相当于vb中的split函数
function SplitString(const Source,ch:string):TStringList;
var
temp:String;
i:Integer;
begin
Result:=TStringList.Create;
//如果是空自符串则返回空列表
if Source=''
then exit;
temp:=Source;
i:=pos(ch,Source);
while i<>0 do
begin
Result.add(copy(temp,0,i-1));
Delete(temp,1,i);
i:=pos(ch,temp);
end;
Result.add(temp);
end;
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
ta=array of array of string;
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure SetTaIn(a:ta);
function GetTaIn:ta;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SetTaIn(a:Ta);
var i,j:integer;
begin
for i:=Low(a) to High(a) do
for j:=Low(a[i]) to High(a[i]) do
Memo1.Lines.Add(a[i][j]);
end;
function TForm1.GetTaIn:Ta;
var a:Ta; i,j:integer;
begin
SetLength(a,3,3);
for i:=0 to 2 do
for j:=0 to 2 do
a[i][j]:=InttoStr((i+1)*(j+1));
Result:=a;
end;
procedure TForm1.Button1Click(Sender: TObject);
var a:Ta;i,j:integer;
begin
a:=GetTaIn;
SetTaIn(a);
end;
end.
- Delphi中,根据字符串,拆分字符串,相当于vb中的split函数
- .net Split方法字符串根据字符串拆分
- Delphi中处理字符串,LastDelimiter相当于C#中的LastIndexOf
- 根据特征拆分字符串函数
- 关于C++中字符串的拆分split函数
- 关于C++中字符串的拆分split函数
- 分解字符串 插入表中 如 1,2,3 相当于 C#中的 Split 方法
- Android中字符串的拆分-split
- java中字符串split拆分*时
- Android中字符串的拆分-split
- Android中字符串的拆分split方法
- Android中字符串的拆分---split()方法
- Android中字符串String的拆分-split
- SPLIT 拆分字符串
- 字符串拆分split
- 字符串的拆分split
- split拆分字符串
- 拆分字符串Split用法
- 消息处理初步
- 苦恼(一)
- Linux 学习之路-------苦行,只为修得正果。每日三省吾身
- GTK+学习笔记1
- GtkWindow — Toplevel which can contain other widgets
- Delphi中,根据字符串,拆分字符串,相当于vb中的split函数
- grub属于bootloader
- 配置RadASM,并写一个消息框程序
- 数据挖掘填补缺失数据
- 自动生成订单编号存储过程
- getRelStyle
- Android---功能模块一之颜色选择器自定义Preference 对话框
- ORA-01480:trailing null missing from STR bind value
- 温馨提示:Android 的 XML 文件是是区分大小写的