Name
RTrim Function
Syntax
RTrim(stringexp
)
-
stringexp
Use: Required
Data Subtype: String
A valid string expression.
Return Value
A Variant of subtype String.
Description
Removes any trailing spaces from stringexp
.
Rules at a Glance
If stringexp
contains a
Null
, RTrim
returns
Null
.
Programming Tips & Gotchas
Unless you need to keep leading spaces, you should use the
Trim
function, which is the equivalent of
RTrim(LTrim(
string
))
,
thereby clearing both leading and trailing spaces in a single
function call.
VB/VBA Differences
Because it does not support strong typing, VBScript does not support
the VBA RTrim$
function, which returns a
strongly typed string rather than a string variant.
See Also
LTrim Function, Trim Function |
Get VBScript in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.