Answers for "golang remove duplicate whitespace"

Go
0

golang eliminate duplicate spaces

space := regexp.MustCompile(`s+`)
str := space.ReplaceAllString("Hello  t n world!", " ")
fmt.Println(str) // "Hello world!"
Posted by: Guest on August-13-2020

Browse Popular Code Answers by Language