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

Clib.strrchr() Method

This method searches a string for the last occurrence of a character in a given string.


Clib.strrchr(string, char)



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


The character to search for


This function returns the substring of string beginning at the rightmost occurrence of char and ending with the rightmost character in string. If char is not found in string, the function returns null.


This method searches the parameter string for the character char. The search is in the reverse direction, from the right, for char in string.

When possible, you should use the standard JavaScript method substring() (see String replace() Method).


The following code fragment:

var str = "I don't like soggy cereal."
var substr = Clib.strrchr(str, 'o');
TheApplication().RaiseErrorText("str = " + str + "\nsubstr = " + substr);

results in the following output:

str = I don't like soggy cereal.
substr = oggy cereal.

See Also

Clib.strchr() Method
Clib.strcspn() Method|
Clib.strpbrk() Method
String replace() Method

Siebel eScript Language Reference Copyright © 2007, Oracle. All rights reserved.