[][src]Function gtin_validate::gtin13::check

pub fn check(code: &str) -> bool

Check that a GTIN-13 code is valid by checking the length (should be exactly 13 digits) and that the check-digit is correct.

Examples

use gtin_validate::gtin13;

assert_eq!(gtin13::check("1498279802125"), true);  // Valid GTIN-13
assert_eq!(gtin13::check("468712378699"), false);  // Too short
assert_eq!(gtin13::check("1498279802124"), false); // Bad check digit