Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Function IBANCheck
PARAMETERS pIban2Check
** 1st move first 4 digits to the end
cAcntnmbr2Chck = ALLTRIM(SUBSTR(pIban2Check,5,50))+LEFT(pIban2Check,4)
cAcntInNmbrs = ''
** change all letters into numbers
FOR x = 1 TO LEN(ALLTRIM(cAcntnmbr2Chck))
cAcntInNmbrs = cAcntInNmbrs+TRANSF(IIF(ISALPHA((SUBSTR(cAcntnmbr2Chck,x,1))),;
(ASC(LOWER((SUBSTR(cAcntnmbr2Chck,x,1))))-87),(SUBSTR(cAcntnmbr2Chck,x,1))))
ENDFOR
** Ibannumbers can be > 32 digits FoxPro can't handle these numbers
** so chop into acceptable portions
cMod = TRANSFORM(MOD(VAL(SUBSTR(cAcntInNmbrs,1,9)),97))
FOR T = 10 TO 24 STEP 7
cMod = TRANSFORM(MOD(VAL(cMod+SUBSTR(cAcntInNmbrs,T,7)),97))
ENDFOR
nResult = VAL(cMod)
* nResult = 1 = passed Iban test
Take care, I have given you the code to valid-check if a given bankaccount number is a valid IBAN number. I have not given you the code to construct an IBAN. This could be done easy enough as well but is also highly UNrecommended. It could lead to wrong solutions. Customers should never construct themselves an IBAN number, this should always be collected from their bank.
In case you publish an 'IBAN-maker' you are facing troubles with the European Banking Athority.
Regards,
Koen
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement