AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
indexOf (String str, int ch) yoix.string
indexOf (String str, String substr)  
 
Returns the index of the first occurrence of the character ch or the string substr in str, or -1 if no match is found.
 
 Example:   The program,
import yoix.stdio.*;
import yoix.string.*;

String  str = "Now is the time";

printf("string=%s, index=%d\n", str, indexOf(str, 'i'));
printf("string=%s, index=%d\n", str+11, indexOf(str+11, 'i'));
printf("string=%s, index=%d\n", str+13, indexOf(str+13, 'i'));
prints
string=Now is the time, index=4
string=time, index=1
string=me, index=-1
on standard output.
 
 Return:   int
 
 See Also:   hashIndex, indexOfObject, lastIndexOf, lastIndexOfObject

 

Yoix is a registered trademark of AT&T Inc.