some functions to work with strings.
Project description
stringthings
a set of functions to work with strings:
-
splits
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'].
-
numbers
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.
-
filenames
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
-
dates
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.
-
compression
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'.
To install this package:
Install it from the pypi.org repository:
pip install stringthings
or upgrade to the latest version:
pip install --upgrade stringthings
Optional requisites:
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stringthings-0.2.3.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for stringthings-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d735b773d238220b6ad75d77de308aa460085b023e1d9c60ac711cf99e12f4d8 |
|
MD5 | e74c4a3bf40589e9d5651bf16fec27d3 |
|
BLAKE2b-256 | 387544fc0caaef695f24ec7b0ed7730bd16d109f1210cea14fd0317a92db257c |