mirror of
https://github.com/fuckpiracyshield/component.git
synced 2024-05-20 05:56:19 +02:00
24 lines
443 B
Python
24 lines
443 B
Python
import re
|
|
|
|
class Filter:
|
|
|
|
"""
|
|
Generic input filter utility.
|
|
"""
|
|
|
|
@staticmethod
|
|
def strip(value: str, character: str = ' '):
|
|
"""
|
|
Strips the character from the start and the end of a string.
|
|
"""
|
|
|
|
return value.strip(character)
|
|
|
|
@staticmethod
|
|
def remove_whitespace(value: str):
|
|
"""
|
|
Removes whitespaces from a string.
|
|
"""
|
|
|
|
return re.sub(r'\s+', '', value)
|