TRIM(string)

Returns the text string without leading and trailing spaces (String).


stringThe text string (String).

REMARKS
* If "string" is Null, then Null is returned.
* You can use the LTRIM function to return the text string without leading spaces.
* You can use the RTRIM function to return the text string without trailing spaces.
* You can use the TRIM$ function to return a String data type instead of a Variant/String data type.
* The equivalent Excel function is Application.WorksheetFunction.TRIM
* Unlike the Excel function this function WILL NOT remove any extra spaces between words.
* The equivalent .NET function is Microsoft.VisualBasic.Strings.Trim
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print Trim("   some text   ")  '= "some text"  
Debug.Print Trim(" hello ") '= "hello"
Debug.Print Trim(" some text ") '= "some text"
Debug.Print Trim(1234) '= "1234"

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top