O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

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

Trim Function

Class

Microsoft.VisualBasic.Strings

Syntax

Trim(str)
str (required; String)

Any string expression

Return Value

String

Description

Removes both leading and trailing spaces from a given string

Rules at a Glance

If string is Nothing, the Trim function returns Nothing.

Programming Tips and Gotchas

Trim is equivalent to calling both the RTrim and LTrim functions.

VB.NET/VB 6 Differences

In VB 6, the function’s single named argument is string. In VB.NET, its single named argument is str.

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