试一试,不知是否你所要的
----------------------------------------------------------------
详细内容:
procedure TForm1.Button2Click(Sender: TObject);
var
num, i: integer;
PersonID: ShortString;
Code: string[1];
begin
PersonID := '13010319620914121';
PersonID := '34052419800101001';
num:= 0;
for i := 18do
wnto 2do
num := num + Trunc(power(2, i-1)) mod 11 * (ord(PersonID[19 - i])-$30);
num := num mod 11;
case num of
0: code := '1';
1: code := '0';
2: code := 'X';
3: code := '9';
4: code := '8';
5: code := '7';
6: code := '6';
7: code := '5';
8: code := '4';
9: code := '3';
10: code := '2';
end;
PersonID := PersonID + code;
end;