TRIM

TRIM(string)

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


stringThe text string (String).

REMARKS
* If "string" is Null, then Null is returned.
* You can use the LTRIM function to return a 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 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 learn.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"

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