C Example: Text Normalizer: Trim, Collapse Spaces and Title Case
A complete command-line text cleaner: trims leading/trailing whitespace, collapses runs of spaces, converts to title case, and reports word/character counts after cleaning. Three inputs cover a normal sentence, a messy-spacing sentence and an empty-string edge case.
🖥 Run OnlineGCC 10.2 · C11 standard · click ▶ to run · Copy code
🖨 Reference OutputMatches the online run in a standard C11 environment
[1] greeting cleaned : "hello WORLD from C" words=4 chars=18 title-case: "Hello World From C" [2] sentence cleaned : "the quick brown fox jumps over the lazy dog" words=9 chars=43 title-case: "The Quick Brown Fox Jumps Over The Lazy Dog" [3] empty cleaned : "" words=0 chars=0 title-case: ""
🧩 Keep Learning