SubStr()

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

3 responses to “SubStr()

  1. Pingback: Harbour All Functions – S | Viva Clipper !

  2. Pingback: Harbour String Functions | Viva Clipper !

  3. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s