Skip to main content

Split long text into parts without breaking words

Project description

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)

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

textdivider-0.2.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textdivider-0.2.1-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

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

Hashes for textdivider-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a21496b1a7b49c0abb7d6e35a1fcbf117dee0c1051101fd2cea1e464ebc20b04
MD5 36a47053a48eb9bdf2a21380c235bbac
BLAKE2b-256 3ff80436f977eb84966c3017eef0629adab19725aa9365da3634d011553abf72

See more details on using hashes here.

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

Hashes for textdivider-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2703dfe62ebc7dd79b683fc7cb129d9f14c420f21902ca35bcc31d1e9559aa9
MD5 f86024da341f55a07c957f0d868cb0ac
BLAKE2b-256 bfd3c26c3f868471145d1ec9f0728b447a33c6ffc67aeb04121793808638bf2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page