Calculate IBAN for Spain from ccc. Calcular IBAN para España desde el ccc.


/ Published in: ASP
Save to your folder(s)

This algorithm calculates an IBAN from a banc account in Spain.

Este algoritmo calcula el IBAN de una cuenta bancaria española


Copy this code and paste it in your HTML
  1. 'rellena con 0 delante
  2. function fill0(s,l)
  3. cad=s
  4. while (len(cad)<l)
  5. cad="0"&cad
  6. wend
  7. fill0=cad
  8. end function
  9.  
  10. 'calcula el modulo 97 para números grandes
  11. function modulo97(number)
  12. tmp = ""
  13. for i = 1 to len(number)
  14. tmp = tmp & mid(cStr(number), i, 1)
  15. r = cInt(tmp) mod 97
  16. tmp = cStr(r)
  17. next
  18. modulo97=tmp
  19. end function
  20.  
  21. function generaibanES(ccc)
  22.  
  23. iban_mi=ccc&"142800" '1428 = "ES" codificado
  24. dciban=modulo97(iban_mi)
  25. dciban=98-dciban
  26. iban="ES"&fill0(dciban,2)&ccc
  27. generaibanES=iban
  28. end function

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.