For the complete documentation index, see llms.txt. This page is also available as Markdown.

Trim Whitespaces From String

To remove whitespaces from a string, we can use strings.TrimSpace function. It would remove leading and trailing spaces from the string.

Example

myString := strings.TrimSpace(" Hello World! ") // "Hello World!"

Source: YourBasic

Last updated