Validation for the Brazilian RENAVAM (Registro Nacional de Veículos Automotores) vehicle registration number.
A RENAVAM has 11 digits: a 10-digit base followed by 1 check digit. Symbols are NOT stripped before validation — any non-digit character makes the input invalid (unlike the CNH validator in this library).| is_valid/1 | Returns whether the given term is a valid RENAVAM: a binary of exactly 11 ASCII digits, not a sequence of one repeated digit, whose check digit (the last one) matches the one computed from its 10-digit base. |
is_valid(Renavam::term()) -> boolean()
Returns whether the given term is a valid RENAVAM: a binary of exactly 11 ASCII digits, not a sequence of one repeated digit, whose check digit (the last one) matches the one computed from its 10-digit base.
No cleaning is performed — spaces, dashes or letters anywhere make
the input invalid. Only the format is verified — the RENAVAM is
not checked for existence. The function is total: any non-binary
term returns false rather than raising.
1> brutils_renavam:is_valid(<<"86769597308">>). true 2> brutils_renavam:is_valid(<<"12345678901">>). false
Generated by EDoc