Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object >

Clib.strstr() Method


This method searches a string for the first occurrence of a second string.

Syntax

Clib.strstr(sourceString, findString)

Parameter
Description
sourceString
The string within which to search
findString
The string to find

Returns

The string beginning at the first occurrence of findString in sourceString, continuing to the end of sourceString; otherwise, null, if findString is not found.

Usage

This method searches sourceString, from its beginning, for the first occurrence of findString. The search is case-sensitive. If the desired result can be accomplished with the standard JavaScript substring() method, that method is preferred.

Example

The following code:

function Test1_Click ()
{
   var str = "We have to go to Haverford."
   var substr = Clib.strstr(str, 'H');
   TheApplication().RaiseErrorText("str = " + str + "\nsubstr = " +substr);
}

results in the following output:

See Also

Clib.strstri() Method and string.replace() Method


 Siebel eScript Language Reference 
 Published: 18 April 2003