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
lastIndexOf (String str, int ch) yoix.string
lastIndexOf (String str, String substr)  
 
Returns the index of the last 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, last index=%d\n",
	str, lastIndexOf(str, 'i'));
printf("string=%s, last index=%d\n",
	str+11, lastIndexOf(str+11, 'i'));
printf("string=%s, last index=%d\n",
	str+13, lastIndexOf(str+13, 'i'));
prints
string=Now is the time, last index=12
string=time, last index=1
string=me, last index=-1
on standard output.
 
 Return:   int
 
 See Also:   hashIndex, indexOf, lastIndexOf, lastIndexOfObject

 

Yoix is a registered trademark of AT&T Inc.