From c611b271b51cefb6df91e865ddd947785ae67254 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 10 Feb 2018 16:52:05 +0100 Subject: Support spaces in BIC codes BIC codes are sometimes written in a space-separated form this correctly cleans the spaces for compact representation. --- stdnum/bic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'stdnum/bic.py') 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): -- cgit v1.2.3