Golang net/textproto.TrimString() function example

package net/textproto

Golang net/textproto.TrimString() function usage example

 package main

 import (
  "fmt"
  "net/textproto"
 )

 func main() {
  str := textproto.TrimString(" abc ") // with space leading and trailing

  fmt.Println(str) // without spaces
  fmt.Println(string(str)) // without spaces
 }

Reference :

http://golang.org/pkg/net/textproto/#TrimString

Advertisement