a set of functions to work with strings:
-
-
multisplit
similar to the.split()
method from the standardstr
class, but able to separate the string using multiple separators at once. -
split_dmmmy
splits a date string in format 'dmmmy' (like '5jan23') into a list ['d', 'mmm', 'y'].
-
-
-
is_numeric
returns True if the string represents a number, not limited to integers as the.isdigit()
string method. -
get_number
extract the number represented by the string.
-
-
-
extension
splits a fullpath represented by the string into:- the extension of the file
- the name of the file
- the directory containing the file
- the input fullpath
-
-
-
is_date
returns True if the input string represents a date. -
format_date
change the format of the date represented by the string, as requested by the user.
-
-
-
compress
compress the repeated items in a string sequence, i.e.: compress('1 2 2 2') returns '1 3*2'. -
expand
expand the compressed string repetitions, i.e.: expand('1 3*2') returns '1 2 2 2'.
-
Install it from the pypi.org repository:
pip install stringthings
or upgrade to the latest version:
pip install --upgrade stringthings
The main functionalities are purely Python powered and does not require any other package to work but, if present, some functions requires NumPy and Pandas:
NumPy
Pandas