Module brutils_renavam

Validation for the Brazilian RENAVAM (Registro Nacional de Veículos Automotores) vehicle registration number.

Description

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).

Function Index

is_valid/1Returns 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.

Function Details

is_valid/1

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