分割字符串

  function SplitString(const source, ch: string): TStringList;
  var
    temp, t2: string;
    i: integer;
  begin
    result := TStringList.Create;
    temp := source;
    i := pos(ch, source);
    while i <> 0 do
    begin
      t2 := copy(temp, 0, i - 1);
      if (t2 <> '') then
        result.Add(t2);
      delete(temp, 1, i - 1 + Length(ch));
      i := pos(ch, temp);
    end;
    result.Add(temp);
  end;

你可能感兴趣的:(分割字符串)