RTRIM

RTRIM(string)

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


stringThe text string (String).

REMARKS
* If "string" = "" (zero length string), then a zero length string is returned.
* If "string" is vbNullString, then a zero length string is returned.
* This function is similar to LTRIM function.
* You can use the LTRIM function to return a text string without leading spaces.
* You can use the RTRIM$ function to return a String data type instead of a Variant data type.
* You can use the RIGHT function to return a substring from the right of a string.
* You can use the TRIM function to return a text string without leading and trailing spaces.
* The equivalent .NET function is [[Microsoft.VisualBasic.Strings.RTrim]]
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print "'" & RTrim("   some text") & "'"            '= '    some text'  
Debug.Print "'" & RTrim(" some text ") & "'" '= ' some text'
Debug.Print "'" & RTrim("some text ") & "'" '= 'some text'
Debug.Print "'" & RTrim(LTrim(" some text ")) & "'" '= 'some text'
Debug.Print "'" & RTrim(Null) & "'" ''

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