No project description provided
Project description
PyInitials, because GvR is shorter than Guido van Rossum
from pyinitials import initials
print(initials('Guido van Rossum')) # prints "GvR"
Installation
Install from PyPi, for example with Poetry:
poetry add pyinitials
Usage
from pyinitials import initials, find, parse, add_to
initials('John Doe') # 'JD'
initials(['John Doe', 'Robert Roe']) # ['JD', 'RR']
# alias for initials('John Doe')
find('John Doe') # 'JD'
parse('John Doe') # Parts(name='John Doe', initials='JD', email=None)
# add initials to name(s)
add_to('John Doe') # 'John Doe (JD)'
# Pass existing initials for names
initials(['John Doe', 'Jane Dane'], existing={'John Doe': 'JD'}) # ['JD', 'JDa']
Notes
Preffered initials can be passed in (JD)
, e.g.
initials('John Doe (JoDo)') # 'JoDo'
If a name contains an email, it gets ignored when calculating initials
initials('John Doe joe@example.com') # 'JD'
If a name is an email, the domain part gets ignored
initials('joe@example.com') # 'jo'
When passing an Array of names, duplicates of initials are avoided
initials(['John Doe', 'Jane Dane']) # ['JDo', 'JDa']
Build and test
Install dependencies:
poetry install
Run the unit-tests:
poetry run pytest
LICENSE
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
pyinitials-0.9.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for pyinitials-0.9.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede12d04a02339070cb2a43cb741bb8c95e29622b0b77e2ff47f6846aace2d10 |
|
MD5 | 9a147dfcb454bc0b76941d96d2602215 |
|
BLAKE2b-256 | 4bb002b4edb6150e1dca229b31c2202addd838628e40e2f0ad2c96860b49328a |