如何将“11/08/2005-RC410-SB450-PTRC-GC-00”字符串当遇到“/”“-”时,把它分开存到其它字符串变量中???
解决方案 »
- 请高手来看下TServerSocket的问题
- 如果取得数据库的表结构信息
- Actionlist出错
- 在编程时一般用什么方法来实现用户权限的设置。
- 打包后程序不能使用?
- VclSkin安装问题!各位老大急救!!!
- couldn't perform the edit because another user changed the record?? 急
- 用过regware4控件的请进来
- 怎样控制memo要显示那一行或列???急啊百分大赠送!!
- 如何编写WindowsNT服务程序?
- Delphi 中如何调用C语言编译的动态连接库---------在线等待!!!!!!
- 如何程序在运行状态,创建一个设计状态的窗体?
var
str: string;
sl: TStringList;
i: integer;
function Split(s: string; c1, c2: Char): TStringList;
var
i: integer;
begin
Result := TStringList.Create;
while (Pos(c1, s)>0) or (Pos(c2, s)>0) do
begin
for i:=1 to Length(s) do
begin
if (s[i]=c1) or (s[i]=c2) then
begin
Result.Add(Copy(s, 1, i-1));
s := Copy(s, i+1, Length(s));
break;
end;
end;
end;
if Length(s)>0 then Result.Add(s);
end;
begin
str := '11/08/2005-RC410-SB450-PTRC-GC-00';
sl := TStringList.Create;
sl := Split(str, '/', '-');
for i:=0 to sl.Count-1 do
ShowMessage(sl[i]);
FreeAndNil(sl);
end;