function StrPas(const Str: PChar): string;
是DELPHI的一个函数

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      S:String;
      BS:Array of Byte;
      I:integer;
    begin
      S:='123456789';
      SetLength(Bs,Length(S));
      for I:=0 to length(S) do begin
        BS[I]:=StrToInt(Copy(S,I,1));
      end;
    end;
      

  2.   

    function StrPas(const Str: PChar): string;
    是DELPHI的一个函数
      

  3.   

    to peihexian(没什么好说的)  如果s:='aaaaaaaaaaaaabbbbccc'呢?
      

  4.   

    老老实实的给分吧:
    procedure TForm1.Button1Click(Sender: TObject);
    var
      S:String;
      BS:Array of Byte;
      I:integer;
      C:PChar;
    begin
      S:='abcde';
      New(C);
      SetLength(Bs,Length(S));
      try
        for I:=0 to length(S) do begin
          StrPCopy(C,Copy(S,I+1,1));
          BS[I]:=Ord(C^);
        end;
      finally
        Dispose(C);
      end;
      For I:=Low(BS) to High(BS) do begin
        ShowMessage(Char(BS[I]));
      end;
    end;
      

  5.   

    何必那么罗嗦,Move最简单快速
    b: array [0..100] of Byte
    Move(PChar(Str)^, @b[0], count)
      

  6.   

    peihexian(没什么好说的) ,你错了,因为string '1234'中1是占2个byte 所以将'1234'中的1换为byte型时,应有两 个字节 b[0]=49,b[1]=0
      

  7.   

    to littleone(小不点):
    在Delphi3的时代,String中第一个Byte中放的是String的长度,但现在好象已不是了,我不知道你说的是什么意思,可能是我的水平不高吧,不过我第二次发的程序执行是正确的,请指点!