diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2012-02-04 20:15:00 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2012-02-04 20:15:00 +0100 |
commit | 41dd8159b43e72f44f2e3ca0afcdeaac563b7180 (patch) | |
tree | e86614d527fa123b84a6efdb097072cf488b1a65 /stdnum/imei.py | |
parent | 54cc2079d50004c7d3c43fb4829cea7d509f0314 (diff) |
implement a stdnum.util module for holding utility functions (for now clean())
git-svn-id: http://arthurdejong.org/svn/python-stdnum/python-stdnum@100 9dea7c4f-944c-4273-ac1a-574ede026edc
Diffstat (limited to 'stdnum/imei.py')
-rw-r--r-- | stdnum/imei.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/stdnum/imei.py b/stdnum/imei.py index 2eb794a..35ae707 100644 --- a/stdnum/imei.py +++ b/stdnum/imei.py @@ -1,7 +1,7 @@ # imei.py - functions for handling International Mobile Equipment Identity # (IMEI) numbers # -# Copyright (C) 2010, 2011 Arthur de Jong +# Copyright (C) 2010, 2011, 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -37,11 +37,13 @@ False ('35686800', '004141', '') """ +from stdnum.util import clean + def compact(number): """Convert the IMEI number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.""" - return number.replace(' ', '').replace('-', '').strip().upper() + return clean(number, ' -').strip().upper() def imei_type(number): |