Created
May 16, 2011 19:58
-
-
Save mat813/975210 to your computer and use it in GitHub Desktop.
rib valid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isRIBvalid(banque, guichet, compte, clef) { | |
var tab= "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
var tab1="123456789123456789234567890123456789".split(""); | |
while (compte.match(/\D/) != null) | |
compte=compte.replace(/\D/, tab1[tab.indexOf(compte.match(/\D/))]); | |
var compte=parseInt(compte, 10); | |
a=banque % 97; | |
a=a*100000+parseInt(guichet, 10); | |
a=a%97; | |
a=a*Math.pow(10, 11) + compte; | |
a=a%97 | |
a=a*100; | |
a=a%97 | |
a=97-a; | |
return clef==a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment