AMT Help Files
homeLION Language ReferenceCommandsRIGHTCOPY

RIGHTCOPY

Syntax

RIGHTCOPY (<Value>, <N-chars>[, <Ignore trailing spaces>])

Description

Returns the last <N-chars> of <Value>. When <N-chars> is greater than the length of <Value> only the available characters are returned.

Diagram

Returned value type

Realstring

Parameters

Parameter Description
<Value> The value to copy from. Must be of type Alpha, String, Realstring, Numeric or Financial.
<N-chars> The number of characters to copy from the right. Must be of type Numeric, integer or a literal value.
<Ignore trailing spaces> Whether to ignore trailing spaces in an Alpha or Realstring or a formatted Numeric/Financial.

Remarks

When at runtime <N-chars> has a value less or equal than zero, an empty string will be returned.

When <Value> is of type Numeric or Financial will always be copied from the end with no trailing spaces, unless full zero suppress or a format allowing trailing spaces has been set. In that case the <Ignore trailing spaces> can be used. When a format is defined for the Numeric or Financial the format will be used for the copy, otherwise normal formatting rules for copying to an alpha field will be used.

Examples

var
  Sa-5   : alpha 5
  Fin-5  : financial 5
  Sn-82  : numeric 8.2 format '999,999.99'
  Rlstr  : realstring
  Result : realstring

code
  Sa-5   := 'abcd'
  Fin-5  := -3
  Sn-82  := 123456.78
  Rlstr  := 'Demo RightCopy '

  Result := rightcopy (Sa-5, 2)          // 'd '
  Result := rightcopy (Sa-5, 2, true)    // 'cd'
  Result := rightcopy (Sa-5, 5, true)    // 'abcd', copies only the 4 avaialble characters
  Result := rightcopy (Sa-5, -2)         // Rejected by compiler

  Result := rightcopy (Sn-82, 4)         // 6.78
  Result := rightcopy (Sn-82, 8)         // 3,456.78

  Result := rightcopy (Rlstr, 4)         // 'py '
  Result := rightcopy (Rlstr, 4, true)   // 'Copy'

Return to

Commands

Contents

 Go to top