SourcePoint Intel Help

Table of Contents

string [ ] (index into string)

Return the nth character in a string.

Syntax

[result =] string-expr [index]

Where:

result

specifies a debug variable of type char to which the function return value is assigned. If result is not specified, the return value is displayed on the next line of the screen.

string-expr

specifies an nstring variable or a quoted string constant.

index

is the character position to return.

Discussion

The [ ] operator returns the nth character in a string. If the index specified is beyond the end of the string, an error message is displayed.

Example

Command input:

define nstring myString = "Hi There!"
myString[0]

Result:

'H'

Command input:

define char myChar
myChar = myString[3]
myChar

Result:

'T'

Related Topics: