Standard library / strings
strings.Trim()
Removes leading and trailing runes in cutset; cutset is not a literal substring. Expected stdout: 'go\n'.
Formal Syntax & Structure
go syntaxgo
func Trim(s, cutset string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text or sequence. |
| cutset | string | Set of code points to remove from the indicated ends. |
Return Value
string
Removes leading and trailing runes in cutset; cutset is not a literal substring.
Working Example
Example Snippetgo
package main
import ( "fmt" "strings")
func main() { fmt.Println(string(strings.Trim("..go.!", ".!")))}