SUBSTR()

Returns a substring from a main string

Syntax

SUBSTR(<cString>,<nStart>[,<nLen>)] --> <cReturn>

Arguments

<cString> Character expression to be parsed

<nStart> Start position

<nLen> Number of characters to return

Returns

<cReturn> Substring of evaluation

Description

This functions returns a character string formed from <cString>, starting at the position of <nStart> and continuing on for a lenght of <nLen> characters. If <nLen> is not specified, the value will be all remaining characters from the position of <nStart>.

The value of <nStart> may be negative. If it is, the direction of operation is reversed from a default of left-to-right to right-to-left for the number of characters specified in <nStart>.
Examples
      FUNCTION MAIN()
      LOCAL X:=REPLICATE('ABCD',70000)

      ? QOUT(SUBSTR(X,65519,200)

      RETURN NIL
Tests
      ? QOUT(SUBSTR('HELLO HARBOUR',5)
Status

Ready

Compliance

This functions is CA CLIPPER compatible with the execption that CA CLIPPER will generate an error if the passed string is >65519 bytes and Harbour depends of plataform.

Platforms

All

Files

Library is rtl

See Also