cTextText to trim; note the documented behavior for other types.
AdvPL GuideAllTrim( <cText> ) --> cRetRemoves spaces from both ends of a string.
AllTrim returns a new string without leading or trailing spaces while retaining internal spaces. The official reference also documents an empty result for non-character input; this is not number-to-text conversion. Compare LTrim and RTrim for one-sided trimming. The original variable changes only if the result is assigned to it. (Ref. 1)
AllTrim( <cText> ) --> cRetcTextText to trim; note the documented behavior for other types.
Character: text without edge spaces; non-character input yields an empty string according to TDN.
#Include "TOTVS.ch"
User Function EdTrim()
Local cText := " Ana Silva "
// Brackets expose the boundaries of the result.
ConOut("[" + AllTrim(cText) + "]")
// AllTrim does not convert the number to text.
ConOut("[" + AllTrim(42) + "]")
Return NilExpected results: [Ana Silva] and []. The internal double space remains. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.