collapsewhitespace: 4d63.com/collapsewhitespace Index | Examples | Files

package collapsewhitespace

import "4d63.com/collapsewhitespace"

Package collapsewhitespace contains a function that collapses whitespace between characters (runes) in a string such that all non-whitespace is only separated by at most one space character.

Index

Examples

Package Files

doc.go string_gte_go110.go

func String Uses

func String(s string) string

String collapses any whitespace that is not a single standalone space, into a single space.

Whitespace is:

'\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).

Code:

s := collapsewhitespace.String("abc def			\nghi")

fmt.Print(s)

Output:

abc def ghi

Package collapsewhitespace imports 2 packages (graph). Updated 2019-01-23. Refresh now. Tools for package owners.