Jump to content


Welcome to the T3Leads Forum.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, create your account today.
To all the members who previously registered on the old T3Leads forum: your registration data were not transferred from the old forum. To get started on the new T3leads.com forum please register again to get access.

Photo

Проверка USA Bank ABA

Каналы для получения лидов

  • Please log in to reply
No replies to this topic

#1 admin

admin

    Admin

  • Administrators
  • 38 posts

Posted 03 September 2013 - 04:28 AM

Bank ABA (Rounting Number) - строка состоящая из 9 цифр, не рекомендуется хранить её как число, т.к. она может начинаться с нулей. Последняя 9 цифра рассчитывается по формуле и служит для проверки правильности ввода.

 

Функции для проверки:

JavaScript

function checkABA(s) {
    var i, n, t;
    t = "";
    for (i = 0; i < s.length; i++){
      	c = parseInt(s.charAt(i), 10);
      	if (c >= 0 && c <= 9)t = t + c;
    }
    if (t.length != 9)return false;
    n = 0;
    for (i = 0; i < t.length; i += 3){
      	n += parseInt(t.charAt(i),     10) * 3
          +  parseInt(t.charAt(i + 1), 10) * 7
          +  parseInt(t.charAt(i + 2), 10);
    }
    if(n != 0 && n % 10 == 0) return true;
    else return false;
}

PHP

function checkABA($value) {
    if(!is_numeric($value)) return false;        
    
    $value = sprintf("%09d", $value);
    
    $n = 0;
    for ($i = 0; $i < 9; $i += 3){
        $n += $value[$i] * 3 + $value[$i+1] * 7 + $value[$i+2];
    }

    if($n != 0 && $n%10 == 0) return true;
    else return false;    
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Copyright © 2017 T3 leads