String Tools¶
Functions for manipulating strings.
is_prefixed ¶
is_prefixed(value, prefix)
Check whether a string starts with the given prefix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The string to check. |
required |
prefix
|
str
|
The prefix to look for. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if |
Source code in src/aibs_informatics_core/utils/tools/strtools.py
17 18 19 20 21 22 23 24 25 26 27 | |
is_suffixed ¶
is_suffixed(value, suffix)
Check whether a string ends with the given suffix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The string to check. |
required |
suffix
|
str
|
The suffix to look for. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if |
Source code in src/aibs_informatics_core/utils/tools/strtools.py
30 31 32 33 34 35 36 37 38 39 40 | |
lowercase ¶
lowercase(value)
Convert a string to lowercase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The string to convert. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The lowercased string. |
Source code in src/aibs_informatics_core/utils/tools/strtools.py
75 76 77 78 79 80 81 82 83 84 | |
removeprefix ¶
removeprefix(value, prefix)
Remove the given prefix from the beginning of a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The original string. |
required |
prefix
|
str
|
The prefix to remove. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The string with the prefix removed, or the original string if not prefixed. |
Source code in src/aibs_informatics_core/utils/tools/strtools.py
43 44 45 46 47 48 49 50 51 52 53 | |
removesuffix ¶
removesuffix(value, suffix)
Remove the given suffix from the end of a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The original string. |
required |
suffix
|
str
|
The suffix to remove. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The string with the suffix removed, or the original string if not suffixed. |
Source code in src/aibs_informatics_core/utils/tools/strtools.py
56 57 58 59 60 61 62 63 64 65 66 | |
uppercase ¶
uppercase(value)
Convert a string to uppercase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The string to convert. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The uppercased string. |
Source code in src/aibs_informatics_core/utils/tools/strtools.py
87 88 89 90 91 92 93 94 95 96 | |