K0NRAD
3/23/2014 - 8:24 PM

create iban number

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")