Trim

Public Function Trim(ByVal InputString As String, Optional ByVal RemoveAllWhitespaceCharacters As Boolean = False) As String

Returns the specified string with leading and trailing spaces/white space removed.

String lText = "    Hello world    "
SendDebug($"[{lText}]") 'Prints '[    Hello world    ]'
SendDebug($"[{Trim(lText)}]") 'Prints '[Hello world]'
SendDebug($"[{Lrim(lText)}]") 'Prints '[Hello world    ]'
SendDebug($"[{Rrim(lText)}]") 'Prints '[    Hello world]'

See also: