function GetNewID(ID: string): string; const W: array[1..18] of Integer = (7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1); A: array[0..10] of Char = ('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); var i, j, S: integer; NewID: string; begin if Length(ID) <> 15 then result := '' else begin NewID := ID; Insert('19', NewID, 7); S := 0; try for i := 1 to 17 do begin j := StrToInt(NewID[i]) * W[i]; S := S + j; end; except result := ''; exit; end; S := S mod 11; Result := NewID + A[S]; end; end;