[][src]Function gtin_validate::gtin8::check

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

Check that a GTIN-8 code is valid by confirming that it is exactly 8 digits in length and that the check-digit is correct.

Examples

use gtin_validate::gtin8;

assert_eq!(gtin8::check("14567810"), true);  // Valid GTIN-8
assert_eq!(gtin8::check("1456781"), false);  // too short
assert_eq!(gtin8::check("14567811"), false); // Bad check digit