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.8.tar.gz
(10.9 kB
view details)
Built Distribution
File details
Details for the file stringthings-0.2.8.tar.gz
.
File metadata
- Download URL: stringthings-0.2.8.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d172ae82ca1eab281aec74f8e1f162acc3e4faddbfbb9ba17f903a24764a9932 |
|
MD5 | d14f03554224770eac6bb073871b9658 |
|
BLAKE2b-256 | 9eb403c75a91163e23dd0c35ec767d3336264719eacc8dd9c9747e04eb1cb013 |
File details
Details for the file stringthings-0.2.8-py3-none-any.whl
.
File metadata
- Download URL: stringthings-0.2.8-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b944f8a4190950368d5f5dc0da829446193e774deb87e45a64302b19507f6486 |
|
MD5 | 33b6e5e08f02896b30c3ad002fed935f |
|
BLAKE2b-256 | cdf001cb3725ca337b1b65209316b1e7285ed8b068adee8a13cffde392ff0eb5 |