admin 管理员组

文章数量: 887021

一段字符串sdfg,d,ddd,ggg,bbb,取出根据指定的字符取出子字符串.

{

   sub:分隔串.

  sData:字符串

  i:第几个字符串

}
function SortStringList(sub:Char;sData: String;i:integer): String;
var
  AList:TStringList;
  Begin
    AList := TStringList.Create;
    Try
        AList.Delimiter := sub;
        AList.DelimitedText := sData;
        Result := AList.Strings[i];
    Finally
        AList.Free;
    end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage (SortStringList(',','05,07,03,01',0));
end; 

本文标签: 一段字符串sdfg D DDD ggg bbb