Skip to content

Instantly share code, notes, and snippets.

@K0NRAD
Created March 23, 2014 20:24
Show Gist options
  • Save K0NRAD/9729314 to your computer and use it in GitHub Desktop.
Save K0NRAD/9729314 to your computer and use it in GitHub Desktop.
create iban number
// 11111111112222222222333333
// 01234567890123456789012345
// |--------------------------|
// ABCDEFGHIJKLMNOPQRSTUVWXYZ
// DE = 1314, FR = 1527, IT = 1829
def iban(bic, ban, country) {
ban = ban.padLeft(10,'0')
bic = bic.padLeft(8,'0')
def checkSum = "${(98 - new BigInteger(bic+ban+country+'00').remainder(97))}".padLeft(2, '0')
return "DE${checkSum}${bic}${ban}"
}
println iban("86000000", "86001030","1314")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment