FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Back  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Class   String
   
Name  

indexOf()

   
Examples  
String str = "CCCP"; 
int p1 = str.indexOf("C"); 
int p2 = str.indexOf("P"); 
int p3 = str.indexOf("CP"); 
println(p1 + ":" + p2 + ":" + p3);  // Prints '0:3:2' 

Description   Tests to see if a substring is embedded in a string and returns the index position of the first occurance of the substring defined in the str parameter. If the str parameter is not found in the string, -1 is returned.
   
Syntax  
indexOf(str)
indexOf(str, fromIndex)
   
Parameters  
str   String: the substring to search

fromIndex   int: the index from which to start the search

   
Returns   int
   
Usage   Web & Application
   
 
 






   
 
Updated: Fri Jul 15 16:36:11 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info