//多字符分割
function Split(const str:String;const Separator: array of Char):TArray<string>;
var
i,index,Total:Integer;
C:Char;
begin
Total := 0;
index := 1;
for I := 0 to str.Length do
begin
for C in Separator do
if str[i] = C then
begin
inc(Total);
SetLength(Result,Total);
Result[Total-1] := Copy(str,index,i - index);
index := i + 1;
end;
end;
SetLength(Result,Total + 1);
Result[Total] := Copy(str,index,str.Length - 1);
end;
//字符串分割
{示例
var
s:string;
str:TArray<string>;
begin
s := '12-3,4*56,78*9,11-1';
str := Split(s,[',','*','-']);
s := '123,456,789,111';
str := Split(s,[',']);
end;
}