Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating very large numbers
Message
De
09/09/2009 05:20:35
 
 
À
09/09/2009 04:19:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01423218
Message ID:
01423229
Vues:
65
This message has been marked as a message which has helped to the initial question of the thread.
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
Fil
Voir

Click here to load this message in the networking platform