to
lenilune168 非常感谢了,再问问你:
function TForm1.PcharSplit(In_Str_NeedSplit
char;Var Out_Arr_Splited:Array of Pchar):Boolean ;
Var
Pv_Int_postion,pv_Int_Rows : integer;
Pv_Str_NeedSplit : String;
BEGIN
Try
Result:=True;
Pv_Str_NeedSplit := In_Str_NeedSplit;
Pv_Int_postion := pos('|',Pv_Str_NeedSplit) ;
if Pv_Int_postion =1 then
begin
delete(Pv_Str_NeedSplit, 1,Pv_Int_postion );
Pv_Int_postion := pos('|',Pv_Str_NeedSplit);
end;
pv_Int_Rows:=0;
while ( Pv_Int_postion > 0 ) do
begin
Out_Arr_Splited[pv_Int_Rows] := Pchar(copy(Pv_Str_NeedSplit, 1, Pv_Int_postion - 1));
delete(Pv_Str_NeedSplit,1,Pv_Int_postion);
//showmessage(Out_Arr_Splited[pv_Int_Rows]);
pv_Int_Rows := pv_Int_Rows + 1;
Pv_Int_postion := pos('|',Pv_Str_NeedSplit);
end ;
Except
Result := False;
exit;
end;
end ;
为什么我调用的时候是空植呢?
我这样调用它:
procedure testf;
var
b : array of Pchar;
begin
setlength(b,10);
test(b);
showmessage(b[1]);
end;