module RomanianValidators::Bic

Constants

COUNTRY_CODES

Public Instance Methods

valid?(bic) click to toggle source

This is only a basic validation of a BIC www.swift.com/biconline/index.cfm?fuseaction=display_aboutbic

# File lib/romanianvalidators/bic.rb, line 19
def valid?(bic)
  return false unless bic.size == 8 || bic.size == 11 # length 8 or 11
  return false unless (bic[0..3] =~ /[^A-Z]/).nil? # first 4 must be letters only
  COUNTRY_CODES.include?(bic[4..5])
end