Equinox Online Help - Language Reference - A to Z

Home

Right [Statement]

Applies to
SyntaxRight(StringItem, SectionExpression) = NewExpression
Action[Statement] Assigns to the rightmost portion of a string.
ScopeUsable anywhere.
NotesYou can use this statement to assign a value to the rightmost portion of StringItem. SectionExpression defines the number of characters that are replaced. The rightmost characters (defined by SectionExpression) are removed from StringItem. NewExpression is then inserted at the end of StringItem, in a cut-and-paste style operation. You cannot insert characters beyond the maximum size of StringItem (remember that trailing spaces in fields and workareas are ignored). This statement works in a similar way as the [ ] notation, which you can use to assign to a single character in a string. Note that you can also use Right as a function, to return part of a string. This feature is described separately, in the previous section.
CategoryString handling
See Also ChrList, Chrs, Compare, Fill, IsNumber, Left_Function, Left_statement, Len, Match, Maxlen, Mid_Function, Mid_Satement, Remove, Replace, Right_Function], Search_SearchNext, SetLen, SetMaxLen, SortOrder, SubstituteData
Example

The following example changes the contents of the string txt from "statement" to "function".

string txt

txt = "statement"

Right(txt, 4) = "" | state
Right(txt, 1) = "ion" | station
Left(txt, 3) = "ac" | action
txt[1] = "fi" | fiction
Mid(txt, 2, 1) = "un" | function