Learn to Code ยท zero-dependency ยท MIT

larztext

Everyday text helpers.

The little text jobs every app needs: cut a string to length with an ellipsis, wrap it to a width, pluralize a word by a count, estimate a post's reading time, pull initials from a name. Individually trivial, collectively fiddly - larztext does them cleanly in one place.

larzscript pkg install text
View on GitHub →Learn the stack

What you get

Try it

import "text" as text
print(text.truncate("a long sentence here", 10))
print(text.wrap("the quick brown fox jumps", 10))
print(text.pluralize("item", 1) + " / " + text.pluralize("item", 3))
print(text.reading_time("word " * 400))
print(text.initials("Ada Lovelace"))
Output
a long ...
the quick
brown fox
jumps
item / items
2
AL

Why it's in the Larz Stack

larztext is a real Larzscript package (larzscript pkg install text) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.