TrimSpace in Go

Posted by GoDoc
Public (Editable by Users)

TrimSpace returns a slice of the string s, with all leading and trailing white space removed, as defined by Unicode.

Go
Edit
package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n"))
}