%stringSubString()

Aliases%stringSubString() %stringSubStr()
Parametersstring @text, integer @start [, integer @length]

    Use this function to extract smaller chunks if text from the given text
@parameter. There are several way to retrieve just the part of the text
@you want.

If the value of @start is non-negative then @start indicates the location
within @text that you wish to start retriving your substring. If @start is
a negative value then it indicates the number of characters from the end
of @text at which you wish to start. If @start is set to 0, then it is
treated as though it were set to 1.

The @length parameter may be omitted in which case %stringSubString()
presumes you want all the text from the @start position onward. If @length
is set to a non-negative value then it indicates the number of characters
to retrieve from the @start position. If @length is negative then it is
taken to mean you want all characters up to the end of @text omitting the
give number from the end.

Examples:

@text = "The cow jumped over the moon."

//
// @sub will contain: "cow jumped over the moon."
//
@sub = %stringSubString( @text, 5 )

//
// @sub will contain: "cow"
//
@sub = %stringSubString( @text, 5, 3 )

//
// @sub will contain: "The cow"
//
@sub = %stringSubString( @text, 1, 7 )

//
// @sub will contain: "The cow"
//
@sub = %stringSubString( @text, 0, 7 )

//
// @sub will contain: "moon."
//
@sub = %stringSubString( @text, -5 )

//
// @sub will contain: "moon"
//
@sub = %stringSubString( @text, -5, -1 )

//
// @sub will contain: "cow jumped"
//
@sub = %stringSubString( @text, 5, -15 )