用FORMAT可不可以?我不会用,请给出语句.

解决方案 »

  1.   

    例如"格"字的Unicode是683C,十进制为26684
      

  2.   

    用widestring,单个widechar数值相当于word型.
      

  3.   

    function StrToUnicode(s: string): string;
    var
      t:widestring;
      i:integer;
      h,l:byte;
    begin
      t:= widestring(s);
      for i:=1 to length(t) do begin
        h:=hi(ord(t[i]));
        l:=lo(ord(t[i]));
        Result:= Result + ' ' + (inttohex(h,2) + inttohex(l,2));
      end;
      Result:= copy(Result,2,length(Result));
    end;用这个,
      

  4.   

    function Encode2(var s:WideString):String;
    var i,len:Integer;
          cur:Integer;
          t:String;
    begin
      Result:='';
      len:=Length(s);
      i:=1;
      while i<=len do
        begin
        cur:=ord(s[i]); //BCD转换
        FmtStr(t,'%4.4X',[cur]);
        Result:=Result+t;
        inc(i);
        end;
      end;
      

  5.   

    w_tao8029(小小剑)  的测试通过 ^_^
      

  6.   

    suuare(督察) 的也测试通过 ^_^