RTrim Function

Trims characters from the right side of a string.

RTrim (string [, char])

Parameters

String  -  (Input, expression, Required)

Specifies the string to be trimmed. If a numeric value is passed, it is first converted into a string. If a non-string value is passed, the result is Error. If Null is passed, Null is returned.

Char  -  (Input, expression, Optional)

Specifies the character to be removed from the right side of the string. If this parameter is omitted, the space character is assumed. If this string contains multiple characters, only the first character is used. If a numeric value is passed, it is first converted into a string. If Error is passed, the result is Error. If Null is passed, a space is assumed.

Return Value

A copy of the passed string trimmed of any trailing characters matching char.

Examples

RTrim (“abc”)

Returns “abc”

RTrim (“ abc “)

Returns “ abc“

RTrim (“ abc ”, “ “)

Returns “ abc”

RTrim (“ abc “, “a”)

Returns “ abc “

RTrim (“---abc---”, “-”)

Returns “---abc”

RTrim (Null)

Returns Null

RTrim (Error)

Returns Error

RTrim (“ abc ”, Null)

Returns “ abc”

RTrim (“ abc ”, Error)

Returns Error

TIP:

Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.

See Also

Functions | Asc function | Chr function | CSet function | Format function | InStr function | LCase function | Left function | Len function | LSet function | LTrim function | Mid function | Replace function | Right function | RSet function | RTrim function | Space function | String function | TCase function | Trim function | UBound function | UCase function


© 2004-2021 looksoftware. All rights reserved.