Internal utilities for Título Eleitoral validation.
Internal utilities for Título Eleitoral validation.
(all-same-digit? s)Checks if all digits are the same.
Args: s - String to check
Returns: true if all digits are the same, false otherwise.
Checks if all digits are the same. Args: s - String to check Returns: true if all digits are the same, false otherwise.
(calculate-first-digit base-digits uf-code)Calculates the first check digit (DV1) of a Voter ID.
Uses the first 8 digits with weights [2 3 4 5 6 7 8 9].
Args: base-digits - String with first 8 digits uf-code - String with 2-digit UF code (validated for length)
Returns: Integer representing the first check digit (0-9) or nil when inputs do not match expected lengths.
Calculates the first check digit (DV1) of a Voter ID. Uses the first 8 digits with weights [2 3 4 5 6 7 8 9]. Args: base-digits - String with first 8 digits uf-code - String with 2-digit UF code (validated for length) Returns: Integer representing the first check digit (0-9) or nil when inputs do not match expected lengths.
(calculate-second-digit uf-code first-digit)Calculates the second check digit (DV2) of a Voter ID.
Uses the 2-digit UF code and DV1 with weights [7 8 9].
Args: uf-code - String with 2-digit UF code first-digit - Integer representing DV1
Returns: Integer representing the second check digit (0-9) or nil when inputs do not match expected lengths.
Calculates the second check digit (DV2) of a Voter ID. Uses the 2-digit UF code and DV1 with weights [7 8 9]. Args: uf-code - String with 2-digit UF code first-digit - Integer representing DV1 Returns: Integer representing the second check digit (0-9) or nil when inputs do not match expected lengths.
(valid-check-digits? voter-id)Validates both check digits of a Voter ID.
Args: voter-id - String with 12 digits (cleaned)
Returns: true if both check digits are valid, false otherwise.
Validates both check digits of a Voter ID. Args: voter-id - String with 12 digits (cleaned) Returns: true if both check digits are valid, false otherwise.
(valid-uf-code? uf-code)Checks if UF code is valid according to TSE rules.
Args: uf-code - String with 2 digits or integer
Returns: true if valid, false otherwise.
Checks if UF code is valid according to TSE rules. Args: uf-code - String with 2 digits or integer Returns: true if valid, false otherwise.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |