Total Complexity | 2 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | """ |
||
2 | ETLT |
||
3 | |||
4 | Copyright 2016 Set Based IT Consultancy |
||
5 | |||
6 | Licence MIT |
||
7 | """ |
||
8 | |||
9 | |||
10 | class WhitespaceCleaner: |
||
11 | """ |
||
12 | Utility class for cleaning whitespace from strings. |
||
13 | """ |
||
14 | |||
15 | # ------------------------------------------------------------------------------------------------------------------ |
||
16 | @staticmethod |
||
17 | def clean(string): |
||
18 | """ |
||
19 | Prunes whitespace from a string. |
||
20 | |||
21 | :param str string: The string. |
||
22 | |||
23 | :rtype: str |
||
24 | """ |
||
25 | # Return empty input immediately. |
||
26 | if not string: |
||
27 | return string |
||
28 | |||
29 | return string.replace(' ', ' ').strip() |
||
30 | |||
32 |