Ltrim

Syntax:

    stringvar = LTRIM(stringvar)

Command Availability:

Available on all microcontrollers.

Explanation:

The Ltrim function trims the 7-bit ASCII space character (value 32) from the left-hand side of a string.

Use Ltrim on text you have received from another source that may have irregular spacing at the left-hand end of the string.

Example:

    Dim TestData As String
    TestData = "   Hello"

    TestData = LTRIM(TestData)          ' <<< the LTRIM instruction
    ' TestData now holds "Hello", with the leading spaces removed

Key line: LTRIM(TestData) — removes only the leading spaces from TestData, leaving any spaces at the end untouched.

See Also:

  • Trim — trimming both ends at once
  • Rtrim — trimming only the right-hand side