string_baseform#

string_baseform(string: str, allow_empty_result: bool = False) str[source]#

Normalize the string input to a uniform form.

If input is a string containing alphanumeric characters or if allow_empty_result is set to True, removes all non-alphanumeric characters and convert characters to lower form.

Parameters
allow_empty_resultbool , defaultFalse

bool indicating whether to return empty result if no alphanumeric characters are present or the original input

stringstr

string to remove special characters from

Returns
str

original input if condition is not met or lower form alphanumeric characters of input.