16,748
社区成员
发帖
与我相关
我的任务
分享
Function LRC(const str : String): String ;
var
c,L,d_lrc:integer;
c_data,h_lrc:string;
begin
c := 1;
L := Length(str);
d_lrc:=0;
while c < L do
begin
c_data := copy(str, c, 2);
d_lrc := d_lrc + strtoint('$' + c_data);
c:=c+2;
end;
If d_lrc > $FF Then
begin
d_lrc := d_lrc Mod $100;
End;
h_lrc := inttoHex(($FF - d_lrc + 1),8);
while pos('0',h_lrc) = 1 do delete(h_lrc,1,1);
If Length(h_lrc) > 2 Then h_lrc := copy(h_lrc, Length(h_lrc) - 1, 2);
result := h_lrc;
End;
Function LRC(str : String): String ;
begin
c := 0;
l := Length(str);
For c := c + 1 To l do
begin
c_data: = copy(str, c, 2);
d_lrc := d_lrc + strtoint('$' + c_data);
end;
If d_lrc > $FF Then
begin
d_lrc := d_lrc Mod $100;
End;
h_lrc = inttoHex(($FF - d_lrc + 1),8);
If Length(h_lrc) > 2 Then
h_lrc := copy(h_lrc, Len(h_lrc) - 1, 2);
LRC := h_lrc;
End;
Function LRC(str : String): String ;
begin
c := 0;
l := Length(str);
For c := c + 1 To l do
begin
c_data: = copy(str, c, 2);
d_lrc := d_lrc + strtoint('$' + c_data);
end;
If d_lrc > $FF Then
begin
d_lrc := d_lrc Mod $100;
End;
h_lrc = inttoHex(($FF - d_lrc + 1),8);
If Length(h_lrc) > 2 Then
h_lrc = copy(h_lrc, Len(h_lrc) - 1, 2);
LRC = h_lrc;
End;