The Problem with Typical Sentence Casers
Most online text tools implement sentence casing using a naive algorithm: they split text whenever they encounter a period (.) and then capitalize the next word. This breaks text in five critical ways:
- Decimals are split:
version 1.5 costs $9.99becomesVersion 1. 5 costs $9. 99. - URLs are corrupted:
visit acme.com todaybecomesVisit acme. Com today. - Trailing periods are lost: The final sentence loses its ending punctuation.
- Ellipses are destroyed:
wait... what happened?becomesWait. What happened?. - Abbreviations break:
u.s.a.becomesU. S. A..
How Text Cleaner Solves It
Text Cleaner's sentence casing engine operates in place without string splitting. It inspects character boundaries using lookahead rules:
- A period only triggers sentence capitalization if followed by whitespace or the end of the text.
- Decimals (numbers adjacent to periods) and web domains are skipped.
- Runs of consecutive terminators (
...,?!) are recognized as single punctuation clusters. - Dotted single-letter abbreviations (such as
u.s.a.) are detected and preserved.