contents   index   previous   next



Clib.strstr()

syntax:

Clib.strstr(srcStr, findStr)

where:

srcStr - a string to search.

 

findStr - a string to find.

 

return:

string - beginning in srcStr with the first character in findStr that was found, else null.

 

description:

This method searches srcStr, starting at srcStr[0], for the first occurrence of findStr. The search is case-sensitive. The method returns a variable indicating the beginning of the first occurrence of findStr in srcStr, else it returns null if findStr is not found in srcStr.

 

see:

Clib.strchr(), Clib.strstri()

 

example:

// The following code fragment:

 

function main()

{

   var Phrase = CString("To be or not to be? beep!";

   do

   {

      Screen.writeln(Phrase);

      Phrase = Clib.strstr(Phrase + 1, "be"); 

   } while (Phrase != null);

}

// results in the following output.

//  To be or not to be? beep!

//  be or not to be? beep!

//  be? beep!

//  beep!

 


Clib.strstri()