如题

解决方案 »

  1.   


    procedure TForm1.Button1Click(Sender: TObject);
    var
    s,st:string;
    str:TStringList;
    i:integer;
    begin
    s:='40001,40002';
    str:=TStringList.Create;
    try
    str.CommaText:=s;
    for i :=0  to str.Count-1 do
        if st='' then st:=str.Strings[i]
        else st:=st+str.Strings[i];
        showmessage(st);
    finally
     str.Free;
    end;
    end;
      

  2.   

    var 
     i,j:Integer;
    begin
     i:=40001;
     j:=40002;
     showmessage(IntToStr(i)+IntToStr(j));
    end;
      

  3.   

    怎么样水变成一块冰,要用铲子铲...你不冰冻,水怎么可能变成冰?你是整数不转换怎么可能变成String?
      

  4.   

    var
      i_Arr: Array of Integer;
      tls: TStringList;
      I: Integer;
    begin
      SetLength(i_Arr, 5);
      try
        //初始化测试数据
        for I := 1 to 5 do begin
          i_Arr[I-1] := 40000+I;
        end;    tls := TStringList.Create;
        try
          //转换成字符串
          for I := 0 to Length(i_Arr) - 1 do begin
            tls.Add(IntToStr(I));
          end;
          //拼接(注:在Delphi2007之后的版本当中,不需要使用StringReplace,而可以直接设置LineBreak为逗号来实现接接)
          ShowMessage(StringReplace(tls.Text, #13#10, ',', [rfReplaceAll]));    finally
          tls.Free;
        end;
      finally
        SetLength(i_Arr, 0);
        i_Arr := Nil;
      end;
    end;
      

  5.   

    我的意思是拼接后的string里是每四个字节的整数,而不是整数字符
      

  6.   


    var
      i_Arr: Array of Integer;
      str: String;
      I: Integer;
      P: PChar;
    begin
      SetLength(i_Arr, 5);
      try
        //初始化测试数据
        for I := 1 to 5 do begin
          i_Arr[I-1] := 40000+I;
        end;    SetLength(str, Length(i_Arr) * sizeof(i_Arr[0])) ;
        P := PChar(str);    //转换成字符串
        for I := 0 to Length(i_Arr) - 1 do begin
          Move(i_Arr[I], P^, sizeof(i_Arr[I]));
          Inc(P, sizeof(i_Arr[I]));
        end;
          
      finally
        SetLength(i_Arr, 0);
        i_Arr := Nil;
      end;
    end;
      

  7.   

    比如40001的二进制码是419c0000,40002的是429c0000,我希望拼接后的是419c0000 429c0000
      

  8.   

    var
      i_Arr: Array of Integer;
      str: String;
      I: Integer;
      
    begin
      SetLength(i_Arr, 5);
      try
        //初始化测试数据
        for I := 1 to 5 do begin
          i_Arr[I-1] := 40000+I;
        end;    //转换成字符串
        SetString(str, PChar(@i_Arr[0]), Length(i_Arr) * sizeof(i_Arr[0]));
      finally
        SetLength(i_Arr, 0);
        i_Arr := Nil;
      end;
    end;
      

  9.   

    是:
    Str := #$41#$9c#$00#$00#$42#$9c#$00#$00;
    吧?