O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

RTrim Function

Syntax

RTrim(stringexp)
stringexp

Use: Required

Data Type: String

A valid string expression.

Return Value

A String.

Description

Removes any trailing spaces from stringexp.

Rules at a Glance

If stringexp contains a Null, RTrim returns Null.

Programming Tips and 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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required