GetSubString(string, int, int)

Get a substring from within a string.

string GetSubString(
    string sString,
    int nOffset,
    int nCount
);

Parameters

sString

Target string.

nOffset

Character offset.

nCount

Number of characters in substring.


Description

Returns a substring of sString containing nCount characters starting from offset nOffset. Returns an empty string on error.



Remarks

The parameter nOffset begins with 0 for the first character in a string, 1 for the second character, 2 for the third character and so on.


Version

1.22

Example

void main()
{
    string sString = "Hello World!";

    // say "Hello"
    SpeakString(GetSubString(sString, 0, 5));

    // say "World!"
    SpeakString(GetSubString(sString, 6, 6));
}

See Also

functions: GetStringLeft | GetStringRight
categories: String Functions


 author: Kristian Markon, editor: Daniel Beckman