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

Clib.strchr() Method

This method searches a string for a specified character.


Clib.strchr(string, char)



A string literal, or string variable, containing the character which is to be searched


The character to be searched


The offset from the beginning of string of the first occurrence of char in string; otherwise, null if char is not found in string. The return value is zero-based. The first character is zero, the second is 1, and so on.


This method searches the parameter string for the character char. When possible, you should use the standard JavaScript method substring(). For more information see String replace() Method.


The following code fragment:

var str = "I can't stand soggy cereal."
var substr = Clib.strchr(str, 's');
TheApplication().RaiseErrorText("str = " + str + "\nsubstr = " + substr);

results in the following output.

I can't stand soggy cereal.
stand soggy cereal.

See Also

Clib.strcspn() Method
Clib.strpbrk() Method
Clib.strrchr() Method
String replace() Method

Siebel eScript Language Reference