check the Tax Identification Number number, default modulo 11.

@param ptin vat id to check
@return true if checksum is ok
6934
private boolean checkModulo11Tin(final String ptin) {
    final int checkSum = ptin.charAt(ptin.length() - 1) - '0';
    int sum = 10;
    for (int i = 0; i < ptin.length() - 1; i++) {
      int summe = (ptin.charAt(i) - '0' + sum) % 10;
      if (summe == 0) {
        summe = 10;
      }
      sum = 2 * summe % MODULO_11;
    }
    int calculatedCheckSum = MODULO_11 - sum;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = 0;
    }
    return checkSum == calculatedCheckSum;
  }
1216451
private final boolean checkHeader(int signature)
    {
        // check the signature
        // Trie in big-endian US-ASCII (0x54726965).
        // Magic number to authenticate the data.
        if (signature != HEADER_SIGNATURE_) {
            return false;
        }

        if ((m_options_ & HEADER_OPTIONS_SHIFT_MASK_) !=
                                                    INDEX_STAGE_1_SHIFT_ ||
            ((m_options_ >> HEADER_OPTIONS_INDEX_SHIFT_) &
                                                HEADER_OPTIONS_SHIFT_MASK_)
                                                 != INDEX_STAGE_2_SHIFT_) {
            return false;
        }
        return true;
    }
1073495
function isValid(checkNumber) {
    if (checkNumber == null) {
      return false;
    }
    var numbers = _splitDigits(checkNumber);
    return numbers.pop() === checkSum(numbers.join(''));
  }
298289
private boolean checkDeVatId(final String pvatId) {
    final int checkSum = pvatId.charAt(10) - '0';
    int sum = 10;
    for (int i = 2; i < 10; i++) {
      int summe = (pvatId.charAt(i) - '0' + sum) % 10;
      if (summe == 0) {
        summe = 10;
      }
      sum = 2 * summe % MODULO_11;
    }
    int calculatedCheckSum = MODULO_11 - sum;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = 0;
    }
    return checkSum == calculatedCheckSum;
  }
379305
private boolean checkDkTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(9) - '0';
    final int sum = ((ptaxNumber.charAt(0) - '0') * 4 //
        + (ptaxNumber.charAt(1) - '0') * 2 //
        + (ptaxNumber.charAt(2) - '0') * 3 //
        + (ptaxNumber.charAt(3) - '0') * 7 //
        + (ptaxNumber.charAt(4) - '0') * 6 //
        + (ptaxNumber.charAt(5) - '0') * 5 //
        + (ptaxNumber.charAt(6) - '0') * 4 //
        + (ptaxNumber.charAt(7) - '0') * 3 //
        + (ptaxNumber.charAt(8) - '0') * 2) //
        % MODULO_11;
    int calculatedCheckSum = MODULO_11 - sum;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = 0;
    }
    return checkSum == calculatedCheckSum;
  }
255377
private boolean checkAtTin(final String ptin) {
    final int checkSum = ptin.charAt(8) - '0';
    final int sum = ptin.charAt(0) - '0' + squareSum((ptin.charAt(1) - '0') * 2) //
        + ptin.charAt(2) - '0' + squareSum((ptin.charAt(3) - '0') * 2) //
        + ptin.charAt(4) - '0' + squareSum((ptin.charAt(5) - '0') * 2) //
        + ptin.charAt(6) - '0' + squareSum((ptin.charAt(7) - '0') * 2);
    final int calculatedCheckSum = (80 - sum) % 10;
    return checkSum == calculatedCheckSum;
  }
475422
private boolean checkAtTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(8) - '0';
    final int sum = ptaxNumber.charAt(0) - '0' + squareSum((ptaxNumber.charAt(1) - '0') * 2) //
        + ptaxNumber.charAt(2) - '0' + squareSum((ptaxNumber.charAt(3) - '0') * 2) //
        + ptaxNumber.charAt(4) - '0' + squareSum((ptaxNumber.charAt(5) - '0') * 2) //
        + ptaxNumber.charAt(6) - '0' + squareSum((ptaxNumber.charAt(7) - '0') * 2);
    final int calculatedCheckSum = (80 - sum) % 10;
    return checkSum == calculatedCheckSum;
  }
506291
public static function withCheckDigitForEan($ean)
    {
        // Sanitize
        $ean = (int) $ean;
        $ean = substr($ean, 0, 12);

        // Validate
        if (strlen($ean) != 12) {
            return null;
        }

        // Calculate (sum)
        $sum = 0;
        for ($i = 0; $i < 12; $i++) {
            $sum += $ean{$i} * ($i % 2 ? 3 : 1);
        }

        // Calculate (check digit)
        $checkDigit = ceil($sum / 10) * 10 - $sum;

        return $ean . $checkDigit;
    }
1250999
public static function getCheckDigit(string $number) : int
    {
        if (! ctype_digit($number)) {
            throw new \InvalidArgumentException('The number must be a string of digits');
        }

        $checksum = self::checksum($number . '0');

        return ($checksum === 0) ? 0 : 10 - $checksum;
    }
72932
public static final boolean verifyFormat(String idNumber) {
        if (StringUtils.isBlank(idNumber)) {
            return false;
        }
        idNumber = idNumber.trim();
        if (!checkIdNumberRegex(idNumber)) {
            return false;
        }
        if (!checkIdNumberArea(idNumber.substring(0, 6))) {
            return false;
        }
        idNumber = convertFifteenToEighteen(idNumber);
        if (!checkBirthday(idNumber.substring(6, 14))) {
            return false;
        }
        if (!checkIdNumberVerifyCode(idNumber)) {
            return false;
        }
        return true;
    }
469908
def valid? number
      raise_on_type_mismatch number
      num, check = split_isbn_number(number)
      convert_number_to_digits(num).length == 9 && self.of(num) == check
    end
218189
public static boolean isNumber(Type t)
  {
    for(int i = 0; i < NUMERICAL_TYPES.length; i++) {
      if(NUMERICAL_TYPES[i] == t) {
        return true;
      }
    }
    return false;
  }
667911
private boolean checkItVatId(final String pvatId) {
    final int checkSum = pvatId.charAt(12) - '0';
    final int sum = pvatId.charAt(2) - '0' + squareSum((pvatId.charAt(3) - '0') * 2)
        + pvatId.charAt(4) - '0' + squareSum((pvatId.charAt(5) - '0') * 2) + pvatId.charAt(6) - '0'
        + squareSum((pvatId.charAt(7) - '0') * 2) + pvatId.charAt(8) - '0'
        + squareSum((pvatId.charAt(9) - '0') * 2) + pvatId.charAt(10) - '0'
        + squareSum((pvatId.charAt(11) - '0') * 2);
    final int calculatedCheckSumIt = 10 - sum % 10;
    return checkSum == calculatedCheckSumIt;
  }
456326
private boolean checkChecksumISBN13(final String isbn) {
    int sum = 0;
    for (int i = 0; i < isbn.length() - 1; i++) {
      sum += (isbn.charAt(i) - '0') * (i % 2 == 0 ? 1 : 3);
    }
    final char checkSum = isbn.charAt(12);
    return 10 - sum % 10 == checkSum - '0';
  }
273284
def valid(number):
    
    checksum = 0

    number_len = len(number)
    offset = ord('0')

    i = number_len - 1
    while i >= 0:
      n = ord(number[i]) - offset
      checksum += n
      i -= 2

    i = number_len - 2
    while i >= 0:
      n = ord(number[i]) - offset
      n *= 2
      if n > 9:
          n -= 9
      checksum += n
      i -= 2

    return checksum%10 == 0
341832
private function validateNational(string $vatNumber): int
    {
        $checkval = 0;

        for ($i = 2; $i <= 8; $i++) {
            $checkval += $this->crossSum((int)$vatNumber[9 - $i] * ($this->isEven($i) ? 2 : 1));
        }

        $checkval = 10 - ($checkval % 10);

        return $checkval % 10;
    }
1238112
def validate(self, tracking_number):
        ""
        tracking_num = tracking_number[:-1].replace(' ', '')
        odd_total = 0
        even_total = 0
        for ii, digit in enumerate(tracking_num):
            if ii % 2:
                odd_total += int(digit)
            else:
                even_total += int(digit)
        total = odd_total + even_total * 3
        check = ((total - (total % 10) + 10) - total) % 10
        return (check == int(tracking_number[-1:]))