golang string remove duplicate spaces code example
Example: golang eliminate duplicate spaces
space := regexp.MustCompile(`\s+`)
str := space.ReplaceAllString("Hello \t \n world!", " ")
fmt.Println(str) // "Hello world!"
space := regexp.MustCompile(`\s+`)
str := space.ReplaceAllString("Hello \t \n world!", " ")
fmt.Println(str) // "Hello world!"