这样的数据
333,33434,343434,3434.........
怎么取得第100个逗号所在的位置
谢谢了

解决方案 »

  1.   

    s:='333,33434,343434,3434.........';
    z:=pos(',',s)
    while z>0 do
    begin
    i:=i+1;
    if i=100 then showmessage(inttostr(z));
    z:=pos(',',s)
    end;
      

  2.   

    var
      S: TStrings;
    begin
      S := TStringList.Create;
      S.DelimitedText := '1,23,456';
      //S[99];
    end;—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————
      

  3.   

    var
    S:string;
    i,n:integer;
    begin
      S;='333,33434,343434,3434.........';
      n:=0;
      for i:=1 to 100 do
        begin
         n:=n+pos(S,','); 
         S:=dalete(S,1,pos(S,','));
        end;
      

  4.   

    var
    S:string;
    i,n:integer;
    begin
      S;='333,33434,343434,3434.........';
      n:=0;
      for i:=1 to 100 do
        begin
         n:=n+pos(',',S); 
         S:=dalete(S,1,pos(',',S));
        end;
      

  5.   

    s:='333,33434,343434,3434.........';
    z:=pos(',',s)
    while z>0 do
    begin
    i:=i+1;
    if i=100 then begin 
    showmessage(inttostr(z));
    exit;
    end;
    z:=pos(',',s)
    end;
      

  6.   

    s:='333,33434,343434,3434.........';
    z:=ansipos(',',s)
    j:= length(s);
    while z>0 do
    begin
         i:=i+1;
         if i=100 then showmessage(inttostr(j - length(s)));     
         s:=copy(s,i,length(s)-i);  //
         z:=ansipos(',',s);
    end;
      

  7.   

    s:='333,33434,343434,3434.........';
    z:=pos(',',s)
    while z>0 do
    begin
    i:=i+1;
    if i=100 then begin 
    showmessage(inttostr(z));
    exit;
    end;
    s1:=copy(s,z+1,length(trim(s)));
    z:=pos(',',s1)
    end;
      

  8.   

    s:=copy(s,z+1,length(s)-z);  //
      

  9.   

    int i,js:='333,33434,343434,3434.........';
    i := 0;
    j:=0;
    while i<100 do
    begin
    if (s[j] = ',') then i:=i+1;
    j:= j+1;
    end;
    showmessage(inttostr(j));