Metadata-Version: 2.4
Name: philiprehberger-string-truncate
Version: 0.1.1
Summary: Truncate strings intelligently without cutting words
Project-URL: Homepage, https://github.com/philiprehberger/py-string-truncate#readme
Project-URL: Repository, https://github.com/philiprehberger/py-string-truncate
Project-URL: Issues, https://github.com/philiprehberger/py-string-truncate/issues
Project-URL: Changelog, https://github.com/philiprehberger/py-string-truncate/blob/main/CHANGELOG.md
Author: Philip Rehberger
License-Expression: MIT
License-File: LICENSE
Keywords: ellipsis,shorten,string,text,truncate
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# philiprehberger-string-truncate

Truncate strings intelligently without cutting words.

## Installation

```bash
pip install philiprehberger-string-truncate
```

## Usage

```python
from philiprehberger_string_truncate import truncate, truncate_middle, truncate_path

truncate("Hello beautiful world", max_length=15)
# "Hello…"

truncate("Hello beautiful world", max_length=15, suffix="...")
# "Hello..."

truncate_middle("Hello beautiful world of code", max_length=20)
# "Hello bea…l of code"

truncate_path("/very/long/path/to/some/file.txt", max_length=25)
# "/very/long/.../file.txt"
```

## API

- `truncate(text, max_length, suffix="…", break_words=False)` — Word-boundary truncation
- `truncate_middle(text, max_length, separator="…")` — Keep start and end
- `truncate_path(path, max_length, separator="/", placeholder="...")` — Path-aware truncation

## License

MIT
