Harbour Reference Guide

 

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

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/07/30