Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/stdnum/bic.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2018-02-10 16:52:05 +0100
committerArthur de Jong <arthur@arthurdejong.org>2018-02-10 16:54:28 +0100
commitc611b271b51cefb6df91e865ddd947785ae67254 (patch)
treedc98dcac23e66da84dbcbdb981ca58805d93cf02 /stdnum/bic.py
parent5fd1ae0437da91b4642f3bdb00c175a511fa8a05 (diff)
Support spaces in BIC codes
BIC codes are sometimes written in a space-separated form this correctly cleans the spaces for compact representation.
Diffstat (limited to 'stdnum/bic.py')
-rw-r--r--stdnum/bic.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdnum/bic.py b/stdnum/bic.py
index 52aae42..7728fc2 100644
--- a/stdnum/bic.py
+++ b/stdnum/bic.py
@@ -30,6 +30,8 @@ branch code.
>>> validate('AGRIFRPP882')
'AGRIFRPP882'
+>>> validate('ABNA BE 2A')
+'ABNABE2A'
>>> validate('AGRIFRPP')
'AGRIFRPP'
>>> validate('AGRIFRPP8')
@@ -56,7 +58,7 @@ _bic_re = re.compile(r'^[A-Z]{6}[0-9A-Z]{2}([0-9A-Z]{3})?$')
def compact(number):
"""Convert the number to the minimal representation. This strips the
number of any surrounding whitespace."""
- return clean(number).strip().upper()
+ return clean(number, ' ').strip().upper()
def validate(number):