Name

LTrim Function

Class

Microsoft.VisualBasic.Strings

Syntax

LTrim(str)
str

Use: Required

Data Type: String

A valid string expression

Return Value

String

Description

Removes any leading spaces from str

Rules at a Glance

  • If str has no leading spaces, the function returns str unmodified.

  • If str is Nothing, LTrim returns Nothing.

Programming Tips and Gotchas

It is unwise to create data relationships that rely on leading spaces, especially since most string-based data types in relational database-management systems (like SQL Server and Access) automatically remove leading spaces.

Get VB .NET Language 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.