Package strings implements simple functions to manipulate UTF-8 encoded strings.
Methods
TrimSpace
TrimSpace returns a slice of the string, with all leading and trailing white space removed, as defined by Unicode.
func TrimSpace(s string) string
Usages
package main
import (
"fmt"
"strings"
)
func main() {
greeting := "\n Hi, nice to meet you \t\n"
fmt.Println(strings.TrimSpace(greeting))
// Hi, nice to meet you
}
'Go > Packages' 카테고리의 다른 글
[Go] Package log (0) | 2020.11.30 |
---|---|
[Go] Package bufio (0) | 2020.10.31 |
[Go] Package errors (0) | 2020.10.29 |
[Go] Package math (0) | 2020.10.27 |
[Go] Package strconv (0) | 2020.10.26 |
댓글