如一个数字:1345678
把他一个一个提取出来为1,3,4,5,6,7,8怎样做?谢谢

解决方案 »

  1.   

    IntToStr
    --------------------
    Value div 10
    Value:=Value mod 10
      

  2.   

    这是一个字符串提去的hstr:array[0..9]of string;//定义数组temp:='0123456789'for i:=0 to length(temp) do
    begin
    hstr[i]:=copy(temp,1,1);//给数组赋值
    delete(temp,1,1);//删除赋过的值
    end;
      

  3.   

    var
      str:string;
      value:integer;
    begin
      value:=12345678;
      str:=emptystr;
      while value<>0 do
      begin
        str:=inttostr(value mod 10)+str;
        value:=value div 10;
      end;
      showmessage(str);
    end;
      

  4.   

    value:=inttostr(1345678);
    for i:=1 to length(value) do
    begin
      j:=copy(value,i,1)
    end;
      

  5.   

    var
      S : String;
      MYList : TStringLIst;
      i : integer;
    begin
      s:='123456789';
      try
        MYList:=TStringList.Create;
        For I:=1 to length(s) do
        begin
          MyList.add(Copy(s,i,1));
        end;
        Showmessage(MyList.text);
      finally
        FreeandNil(MYList);
      end;
    end;
      

  6.   

    function IntToStr(Value: Integer): string; overload;
    function IntToStr(Value: Int64): string; overload;
    得到字符串,也就得到了每一位的数字。
      

  7.   

    a:array[0..9]of string;//定义数组temp:='0123456789'for i:=0 to length(temp) do
    begin
    a[i]:=copy(temp,i,1);//给数组赋值
    end;
      

  8.   

    b:=23847837
    a:stringa:=inttostr(b);
    a[0]
    .
    .
    a[length(a)-1]
      

  9.   

    value:=inttostr(1345678);
    for i:=1 to length(value) do
    begin
      j:=copy(value,i,1)
    end;就可以了,最简单