textdivider
Split long text into chunks without breaking words. Useful for social media, messaging platforms, or UI components with length limits.
Installation
pip install textdivider
Features
✅ Split text by max characters, preserving whole words
✅ Optional numbering (e.g. "1/3: ...")
✅ Split text by max number of words
Usage
from textdivider import split_text, split_by_words
text = "This is a long message that you want to divide into parts without cutting words in the middle."
# Split by character count
chunks = split_text(text, max_length=50)
print(chunks)
# With numbering
numbered = split_text(text, max_length=50, numbered=True)
print(numbered)
# Split by word count
word_chunks = split_by_words(text, max_words=5)
print(word_chunks)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
textdivider-0.2.1.tar.gz
(2.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textdivider-0.2.1.tar.gz.
File metadata
- Download URL: textdivider-0.2.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a21496b1a7b49c0abb7d6e35a1fcbf117dee0c1051101fd2cea1e464ebc20b04
|
|
| MD5 |
36a47053a48eb9bdf2a21380c235bbac
|
|
| BLAKE2b-256 |
3ff80436f977eb84966c3017eef0629adab19725aa9365da3634d011553abf72
|
File details
Details for the file textdivider-0.2.1-py3-none-any.whl.
File metadata
- Download URL: textdivider-0.2.1-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2703dfe62ebc7dd79b683fc7cb129d9f14c420f21902ca35bcc31d1e9559aa9
|
|
| MD5 |
f86024da341f55a07c957f0d868cb0ac
|
|
| BLAKE2b-256 |
bfd3c26c3f868471145d1ec9f0728b447a33c6ffc67aeb04121793808638bf2d
|