大虾们 ,delphi字符串16进制 ,在线等待!

解决方案 »

  1.   

    {===============================================================}     
      {   函数     :   RESULTSTRING   =   HexToBin(HEXSTRING)     
      {   目的       :   把十六进制字符串转换为二进制字符串         
      {     
      {===============================================================}     
      {   函数     :   RESULTINTEGER   =   HexCharToInt(HEXCHAR)     
      {   目的       :   转换一个十六进制字符为整数   
      {===============================================================}     
      {   函数     :   RESULTSTRING   =   HexCharToBin(HEXCHAR)     
      {   目的       :   转换一个十六进制字符为二进制字符串   
      {===============================================================}     
      {   函数     :   RESULTINTEGER   =   Pow(BASE,POWER)     
      {   目的       :   指数函数   
      {===============================================================}     
      {   函数     :   RESULTINTEGER   =   BinStrToInt(BINSTRING)     
      {   目的       :   把二进制字符串转换为整数   
      {===============================================================}     
      {   函数     :   RESULTSTRING   =   DecodeSMS7Bit   (PDUSTRING)     
      {   目的       :   解码一个7-bit   SMS   (GSM   03.38)   为ASCII码     
      {===============================================================}     
      {   函数     :     RESULTSTRING   =   ReverseStr   (SOURCESTRING)     
      {   目的       :   反转一个字符串   
      {===============================================================}     
      

  2.   

    var
      str, strHex: string;
      I: Integer;
    begin
      str := 'This is a test string.';
      for I := 1 to Length(str) do
        strHex := strHex + IntToHex(Ord(str[I]), 2);
    end;
      

  3.   

    大虾们 ,delphi字符串转化为16进制 ,在线等待!
      

  4.   

    BinToHexvar
      Str_Src,Str_Dst: AnsiString;
      iSize: Integer;
    begin
      Str_Src := '测试数据';
      iSize := Length(Str_Src);
      SetLength(Str_Dst,iSize*2);
      BinToHex(PAnsiChar(str_Src),PAnsiChar(Str_Dst),iSize);
      ShowMessage(str_Dst);
    end;
      

  5.   

    function TForm1.StrToHexStr(const S:string):string;
    var
      I:Integer;
    begin
      for I:=1 to Length(S) do
      begin
        if I=1 then
          Result:=IntToHex(Ord(S[1]),2)
        else Result:=Result+IntToHex(Ord(S[I]),2);
      end;
    end;
      

  6.   

    “2”,即为ASCII码50(10进制),转成16进制,不是“32”是什么?
      

  7.   

    我拜托,那你写Str = #2吧...
      

  8.   

    如果你要的是IntToHex,那可以写ShowMessage(IntToHex(100,2));
    或者ShowMessage(Format('%x',[100]));
      

  9.   

    var
      s: String;
    begin
      s := Edit1.text;
      edit2.text := Format('%x',[StrToInt(s)]);
    end;