const
  Digits : array[0..$F] of Char = '0123456789ABCDEF';function HexB(B : Byte) : string;
  {-Return hex string for byte}
begin
    HexB:=Digits[B shr 4]+Digits[B and $F];
end;我初学DILPHI对于以上代码有几点不明白的.
1.array[0..$f]中的$f是什么意思啊,0..$F又是什么意思啊
2.Char = '0123456789ABCDEF';是不是限定只能是这几个字符中的字符?
3.B shr 4和B and $F是什么意思呢?
不好意思啊,我是菜鸟!!1
明白了就给分

解决方案 »

  1.   

    array[0..$f]相当于array[0..15]    $表示16进制
    array[0..$F] of Char = '0123456789ABCDEF';  给数组赋值,这个数组下标从0..15有16个char类型的单元
    shr,and 是位运算 //我们通常用and是用在逻辑运算符
      

  2.   

    1,$f是表示16进制;F也就是十进制的16啊;
    2,是
    3,位操作啊;SHR右移动4位;AND;按位AND操作;
    这个函数返回一个BYTE的16进制编码;
    The following logical operators perform bitwise manipulation on integer operands. For example, if the value stored in X (in binary) is 001101 and the value stored in Y is 100001, the statementZ := X or Y;assigns the value 101101 to Z.Logical (bitwise) operators 
    Operator Operation Operand types Result type Examples
    not bitwise negation integer integer not X
    and bitwise and integer integer X and Y
    or bitwise or integer integer X or Y
    xor bitwise xor integer integer X xor Y
    shl bitwise shift left integer integer X shl 2
    shr bitwise shift right integer integer Y shr I
    The following rules apply to bitwise operators.The result of a not operation is of the same type as the operand.
    If the operands of an and, or, or xor operation are both integers, the result is of the predefined integer type with the smallest range that includes all possible values of both types.
    The operations x shl y and x shr y shift the value of x to the left or right by y bits, which (if x is an unsigned integer) is equivalent to multiplying or dividing x by 2^y; the result is of the same type as x. For example, if N stores the value 01101 (decimal 13), then N shl 1 returns 11010 (decimal 26). Note that the value of y is interpreted modulo the size of the type of x. Thus for example, if x is an integer, x shl 40 is interpreted as x shl 8 because an integer is 32 bits and 40 mod 32 is 8.
      

  3.   

    我正要更正 outer2000(天外流星) 你的错误,结果你先发现了,呵呵
      

  4.   

    呵呵,来晚了,抄一个1,$f是表示16进制;F也就是十进制的15啊;
    2,是
    3,位操作啊;SHR右移动4位;AND;按位AND操作;
    这个函数返回一个BYTE的16进制编码;
      

  5.   

    1.array[0..$f]中的$f是什么意思啊,0..$F又是什么意思啊
    --表示16进制
    2.Char = '0123456789ABCDEF';是不是限定只能是这几个字符中的字符?
    --是
    3.B shr 4和B and $F是什么意思呢?
    --B shr 4意思是右移4位,shl是左移。