Skip to content

Instantly share code, notes, and snippets.

@rms1000watt
Created July 30, 2019 19:24
Show Gist options
  • Save rms1000watt/61dc5e1c957884c60d339761256d71fe to your computer and use it in GitHub Desktop.
Save rms1000watt/61dc5e1c957884c60d339761256d71fe to your computer and use it in GitHub Desktop.
Golang Remove all redundant whitespace inside string
// https://stackoverflow.com/a/42251527
t := "hello world friends"
t = strings.Join(strings.Fields(t), " ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment