github.com/cli/cli@v1.14.1-0.20210902173923-1af6a669e342/pkg/text/sanitize.go (about)

     1  package text
     2  
     3  import (
     4  	"regexp"
     5  	"strings"
     6  )
     7  
     8  var ws = regexp.MustCompile(`\s+`)
     9  
    10  func ReplaceExcessiveWhitespace(s string) string {
    11  	return ws.ReplaceAllString(strings.TrimSpace(s), " ")
    12  }