谢谢

解决方案 »

  1.   

    function HexTobinStr(const Hex:string):string;
    const ss:array[0..15] of string=('0000','0001','0010','0011','0100','0101',
                                     '0110','0111','1000','1001','1010','1011','1100',
                                     '1101','1110','1111');
    var i,ptr:integer;
    begin
        result:=''   ;
        for i:=1 to length(hex)  do
        begin
           case hex[i] of
             '0'..'9':ptr:=ord(hex[i])-ord('0');
             'a'..'f':ptr:=ord(hex[i])-ord('a')+10;
             'A'..'F':ptr:=ord(hex[i])-ord('A')+10;
           else
             ptr:=0;
           end;
           result:=result+ss[ptr];
        end;
    end;