| Did you know ... | Search Documentation: |
| Pack ltcodes -- c/README.md |
Validate Lithuanian personal codes, company codes, VAT numbers and IBANs in plain C99. Two files, no allocations, no dependencies, so it fits on a microcontroller as well as on a server.
idf.py add-dependency "ello-lithuania/ltcodes"
#include "ltcodes.h"
if (ltcodes_is_iban("LT12 1000 0111 0100 1000")) {
/* ... */
}
Copy ltcodes.c and include/ltcodes.h, or add this folder with CMake:
add_subdirectory(ltcodes/c) target_link_libraries(your_app ltcodes)
bool ltcodes_is_personal_code(const char *code); /* asmens kodas */ bool ltcodes_birth_date(const char *code, int *year, int *month, int *day); bool ltcodes_is_company_code(const char *code); /* juridinio asmens kodas */ bool ltcodes_is_vat_number(const char *code); /* PVM mokÄtojo kodas */ bool ltcodes_is_iban(const char *code);
cmake -S . -B build && cmake --build build python3 test/cases.py | ./build/test_ltcodes
The cases are the shared test vectors of the ltcodes repository, which also has the same rules in Rust, JavaScript, R, D, OCaml and other languages.
Made by KokybiskaSvetaine.lt. Licence: MIT.