Strings
Strings class#
Modifies the strings to the desired format.
latinise(string: str) -> str
#
Removes special unicode characters from the string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to transliterate special unicode characters into latin characters. |
required |
Returns:
Type | Description |
---|---|
str
|
The string with special unicode characters transliterated. |
Examples:
Source code in stringmatch/strings.py
remove_punctuation(string: str) -> str
#
Removes punctuation from a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to remove punctuation from. |
required |
Returns:
Type | Description |
---|---|
str
|
The string with punctuation removed. |
Examples:
Source code in stringmatch/strings.py
alphanumeric(string: str) -> str
#
Removes all non-latin letters from the string. Does also keep numbers. A more extreme version of remove_punctuation().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to remove non-latin letters from. |
required |
Returns:
Type | Description |
---|---|
str
|
The string with non-latin letters removed. |
Examples:
Source code in stringmatch/strings.py
ignore_case(string: str, lower: bool = True) -> str
#
Removes case from a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to remove case from. |
required |
lower |
bool
|
If to convert the string to all lower case, by default True. If set to False, converts it to all upper case. |
True
|
Returns:
Type | Description |
---|---|
str
|
The string with case removed. |
Examples:
>>> ignore_case("Hello there!")
'hello there!'
>>> ignore_case("Hello there!", lower=False)
'HELLO THERE!'