关于的Delphi算法的问题
各位大侠:
帮帮小妹吧!在Delphi中如何把BCD码转化成ASCLL码?(写个函数),我现在急啊!帮忙了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
问题点数:20、回复次数:1Top
1 楼hydonlee(青山情)回复于 2006-03-13 17:49:37 得分 0
function BcdToStr(const ABcdValue: array of Byte): string;
var
i: integer;
begin
SetLength(Result, Length(ABcdValue) * 2); //决定字串长度
for i := Low(ABcdValue) to High(ABcdValue) do
begin
//右移4位取高4位
Result[i * 2 + 1] := Chr((ABcdValue[i] shr 4) + 48);
//与(1111)2来取低4位
Result[i * 2 + 2] := Chr((ABcdValue[i] and $F) + 48);
end;
end;Top




