Viva Clipper !

SubStr()

Advertisements

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 length 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>. If the number of characters from <nStart> to the end of the string is less than <nLen> the rest are ignored.

Examples

      ? SubStr( "HELLO HARBOUR" ,   7,  4 )      // HARB
      ? SubStr( "HELLO HARBOUR" ,  -3,  3 )      // OUR
      ? SubStr( "HELLO HARBOUR" ,   7    )      // HARBOUR

Compliance

Clipper

Platforms

All(64K)

Files

Library is core

Seealso

Left(), At(), Right()

Advertisements

Advertisements