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