计算机二级DELPHI函数:delphi中的split函数计算机二级考试
文章作者 100test 发表时间 2009:04:30 03:54:12
来源 100Test.Com百考试题网
2009年下半年全国计算机等级考试你准备好了没?考计算机等级考试的朋友,2009年下半年全国计算机等级考试时间是2009年9月19日至23日。更多优质资料尽在百考试题论坛 百考试题在线题库
delphi 中的 split 函数 类似于 vb中的 split函数
type
userarray=array of string.
function split(s:string.dot:char):userarray.
var
str:userarray.
i,j:integer.
begin
i:=1.
j:=0.
SetLength(str, 255).
while Pos(dot, s) >. 0 do //Pos返回子串在父串中第一次出现的位置.
begin
str[j]:=copy(s,i,pos(dot,s)-i).
i:=pos(dot,s) 1.
s[i-1] := chr(ord(dot) 1).
j:=j 1.
end.
str[j]:=copy(s,i,strlen(pchar(s))-i 1).
result:=str.
end.