You are here:

Validate an IBAN

forget isdigit?


// countrycode checksum bankcode sortcode accountnumber


: isdigit?   ( char -- boolean )

  dup '0' >=

  swap '9' <= and



: stripspaces   ( IBAN -- IBAN' )

   "" 2swap split for

    forobj concat$




: valid?   ( IBAN -- boolean )

  string NUM$

  0 char-array IBAN


  >carr a@ IBAN a!

  4 0 do

    IBAN 0 <@

    IBAN |<!


  IBAN a@ 0 do

    dup isdigit? not if

      asc 55 -


    NUM$ swap str$ s<& drop


  NUM$ @


  97 mod

  1 ==



"GB26 MIDL 4005 1512 3456 74" valid? . cr

ok> true


Why to use 7th

  • 7ᵗʰ comes in a tiny package of only about 0.5 Mb containing the whole IDE
  • 7ᵗʰ needs no installation – only a download of one jar-file to start
  • 7ᵗʰ contains an integrated help
  • 7ᵗʰ is fully integratable in existing or new Java programs
  • 7ᵗʰ has access to Java™ classes and its member functions
  • 7ᵗʰ implements the ScriptEngine pattern
  • 7ᵗʰ runs on every computer with an installed JVM
  • 7ᵗʰ can run headless as a console application
  • 7ᵗʰ programs / words are very compact
  • 7ᵗʰ supports a Perl-like search and substitution syntax

here You can download the source-code of the example on the left:

Validate an IBAN:

We respect Your privacy and we neither track You nor use cookies…
7th and the 7th logo are trademarks of 7th Stone Software GmbH. All other product or service names are the property of their respective owners.