Siebel eScript Language Reference > Siebel eScript Commands > Clib Object String Methods >
Clib.strstr() Method
This method searches a string for the first occurrence of a second string. Syntax
Clib.strstr(sourceString, findString)
|
|
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: str = We have to go to Haverford substr = Haverford
See Also
Clib.strstri() Method String replace() Method
|