我有3个阵列,例如:比较阵列在Delphi
const
A: Array[0..9] of Byte = ($00, $01, $AA, $A1, $BB, $B1, $B2, $B3, $B4, $FF);
B: Array[0..2] of Byte = ($A1, $BB, $B1);
C: Array[0..2] of Byte = ($00, $BB, $FF);
有没有办法进行比较,并得到正确的索引,而不是检查由1每个字节1?例如:
function GetArrayIndex(Source, Value: Array of Byte): Integer;
begin
..
end;
GetArrayIndex(A, B); // results 3
GetArrayIndex(A, C); // results -1
在此先感谢您。
这里是答案,[是否有任何“Pos”函数来查找字节?](http://stackoverflow.com/q/4959566/576719)。 –
伟大而快速的回复。 (我花了大约1小时半在没有做任何事的时候找不到任何东西)。谢谢!为了利用这些功能,我必须研究更多关于指针等的内容。 –
我会发布一个安德烈亚斯答案的重做版本供你学习。 –