Standard library / strings
strings.TrimSpace()
Removes leading and trailing Unicode whitespace, not internal whitespace. Expected stdout: 'سلام\n'.
Formal Syntax & Structure
go syntaxgo
func TrimSpace(s string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text or sequence. |
Return Value
string
Removes leading and trailing Unicode whitespace, not internal whitespace.
Working Example
Example Snippetgo
package main
import ( "fmt" "strings")
func main() { fmt.Println(string(strings.TrimSpace(" سلام ")))}