I need a function which strips the leading and trailing whitespaces from a string.
func! RemoveWhitespaces(String)
...
return formattedString
endfunc
I was only able to find ways to substitute lines in buffer with their whitespaces stripped but this is not what I'm looking for.
How should I complete this function?