Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

Right

Right(cText,nCount) -> cRet

Extracts the final characters of a string.

RightAdvPL
01 · OVERVIEW

Overview

Returns a suffix copy. Zero yields empty text, a count larger than the source yields the full source, and a negative count raises an error according to TDN. Input is unchanged. Verify counting behavior for the environment encoding; this example uses ASCII. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

Right(cText,nCount) -> cRet

Parameters

cText
CharacterRequired

Source text.

nCount
NumericRequired

Nonnegative character count.

Return value

Character: requested suffix.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed631()
    // Memory-only operation; input remains unchanged.
    ConOut(Right("ABCDEF",3))
Return Nil
Expected result

Expected result: DEF. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check types, bounds and context before using external input.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Right. 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