Skip to content

Instantly share code, notes, and snippets.

@susannej
susannej / IbanMiniTools.groovy
Created April 6, 2016 11:47
IBAN (International Bank Account Number) mini tools (check, trim, expand)
// really, really, really simple IBAN check and helper methods
boolean ibanCheck(String iban) {
String iban2 = iban2DB(iban)
String bban = iban2.substring(4)
String lkzPrf = iban2.substring(0,4)
String ibanDec = ""
(bban + lkzPrf).each { c ->
if (c >= "0" && c <= "9")
ibanDec += c
@susannej
susannej / bicRegex.groovy
Last active May 9, 2017 14:05
BIC (Business Identifier Code / Bank Identifier Code) regex
// really, really, really simple - only regex based - bic check
// /(?i).../ is the java equivalent to /.../i
boolean bicCheck(String bic) {
bic ==~ /(?i)[a-z]{6}[a-z2-9][a-np-z0-9]([a-wyz0-9][a-z0-9]{2})?(x{3})?/ ? true : false
}