Last updated 8 months ago
To remove whitespaces from a string, we can use function. It would remove leading and trailing spaces from the string.
myString := strings.TrimSpace(" Hello World! ") // "Hello World!"
Source:
strings.TrimSpace