Take Command / TCC Help v. 13.03

@INDEX

Hide Navigation Pane

@INDEX

Previous topic Next topic No directory for this topic No expanding text in this topic  

@INDEX

Previous topic Next topic Topic directory requires JavaScript JavaScript is required for expanding text JavaScript is required for the print function Mail us feedback on this topic!  

Comments (...)

@INDEX[string1,string2[,n]]:  Returns the offset of string2 within string1, or -1 if string2 is not found or if string1 is empty. The first or leftmost position in string1 is numbered 0. The optional third parameter n has three different interpretations:

 

If n > 0, it specifies that the nth match from left to right is desired.

If n < 0 or it is prefixed with the minus sign -,  it specifies that the -nth match from right to left is desired.

If n=0, the total number of matches is desired.

 

When n is omitted, the value returned is the offset of the first (leftmost) match.

 

Tips

 

searching for a comma :

 

1.quote string1 (to prevent the expected comma making it appear as more than one parameter)
2.use escape character or its pseudovariable form %= in string2 to escape the comma

         echo %@index["TCC, Take Command, TCCLE",^,,2]

 

searching for a double quote :

 

1.use escape character or its pseudovariable form %= in string2 to escape the double quote
2.use the special form ^q to represent it in string2:

 echo %@index[contains a "quoted" word,^q,0]

 

See Codes for Escapable Characters for details.

 

Examples:

 

In all examples below

 

string1:This is a fine help file

string2:h

 

n

result

purpose

omitted

1

locate leftmost

0

2

count occurrences

1

1

locate leftmost

2

15

locate second leftmost

3

-1

locate third leftmost

-1

15

locate rightmost

-2

1

locate second rightmost

-3

-1

locate third rightmost

 

 

Comments (...)