String manipulation
Len(cText); LTrim(cText); Left(cText,nCount); Lower(cText)Combines text operations with explicit bounds.
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.)
Syntax
Len(cText); LTrim(cText); Left(cText,nCount); Lower(cText)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 NilPrints the bracketed input, then item. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- 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.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.