Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

String manipulation

Len(cText); LTrim(cText); Left(cText,nCount); Lower(cText)

Combines text operations with explicit bounds.

String manipulationAdvPL
01 · OVERVIEW

Overview

Len measures length, LTrim removes leading spaces, Left extracts a prefix and Lower converts to lowercase. These operations differ: removing leading spaces preserves trailing ones; case conversion neither validates identifiers nor normalizes Unicode. This example uses ASCII and keeps the original input for comparison. (Sources: refs. 1–4.)

02 · SYNTAX

Syntax

Len(cText); LTrim(cText); Left(cText,nCount); Lower(cText)
03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed518()
    Local cRaw := "  ITEM01 "
    Local cWork := LTrim(cRaw)
    // Preserve input; transform a copy.
    ConOut("["+cRaw+"]")
    ConOut(Lower(Left(cWork,4)))
Return Nil
Expected result

Prints the bracketed input, then item. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Define encoding and policies for spaces, accents and empty fields. Avoid changing keys or legal content through generic cleanup rules.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Len. TDN. Accessed on 2026-10-27.
  2. TOTVS. LTrim. TDN. Accessed on 2026-10-27.
  3. TOTVS. Left. TDN. Accessed on 2026-10-27.
  4. TOTVS. Lower. TDN. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha