Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

backOpen Source→string-collapse-white-space→Examples

Permalink to Table of ContentsTable of Contents

  • Quick Take
  • Minify a chunk of CSS selector
  • Collapse a run containing tabs
  • Replace tabs inside whitespace runs with ordinary spaces
  • Keep at most one consecutive empty line
  • Collapse but preserve one leading space
  • Preserve one space around each line's content
  • Collapse but preserve one trailing space
  • Remove empty lines from multiline text
  • Inspect the ranges used to produce the collapsed result
  • Trim whitespace from the start and end of every line
  • Trim multiline content whose boundaries contain non-breaking spaces
  • Trim raw non-breaking spaces with ordinary whitespace
↑ back to top

Permalink to Quick TakeQuick Take

↑ back to top

Permalink to Minify a chunk of CSS selectorMinify a chunk of CSS selector

↑ back to top

Permalink to Collapse a run containing tabsCollapse a run containing tabs

↑ back to top

Permalink to Replace tabs inside whitespace runs with ordinary spacesReplace tabs inside whitespace runs with ordinary spaces

↑ back to top

Permalink to Keep at most one consecutive empty lineKeep at most one consecutive empty line

↑ back to top

Permalink to Collapse but preserve one leading spaceCollapse but preserve one leading space

↑ back to top

Permalink to Preserve one space around each line's contentPreserve one space around each line's content

↑ back to top

Permalink to Collapse but preserve one trailing spaceCollapse but preserve one trailing space

↑ back to top

Permalink to Remove empty lines from multiline textRemove empty lines from multiline text

↑ back to top

Permalink to Inspect the ranges used to produce the collapsed resultInspect the ranges used to produce the collapsed result

↑ back to top

Permalink to Trim whitespace from the start and end of every lineTrim whitespace from the start and end of every line

↑ back to top

Permalink to Trim multiline content whose boundaries contain non-breaking spacesTrim multiline content whose boundaries contain non-breaking spaces

↑ back to top

Permalink to Trim raw non-breaking spaces with ordinary whitespaceTrim raw non-breaking spaces with ordinary whitespace

↑ back to top
back 

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab