text
natural_sort_key(s, _nsre=re.compile('([a-zA-Z]+)(\\d+)'))
Utility function for sorting strings of the form A1, B_2, A12 etc. so that the suffixes will be in numeric order rather than lexicographical order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s |
str
|
the string whose sort key to determine |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
the (str, int) natural sort key for the provided string |
Source code in chmpy/util/text.py
overline(x)
Add a unicode overline modifier to the provided string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
str
|
the string to be overlined |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the overlined string |
subscript(x)
Convert the provided string to its subscript equivalent in unicode
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
str
|
the string to be converted |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the converted string |