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

Clib.strrchr() Method


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

Syntax

Clib.strrchr(string, char)

Parameter
Description
string
A string literal, or string variable, containing the character to be searched for
char
The character to search for

Returns

The offset from the beginning of string of the first occurrence of char in string; otherwise, null, if char is not found in string.

Usage

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() (read string.replace() Method).

Example

The following code fragment:

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

results in the following output:

See Also

Clib.strchr() Method, Clib.strcspn() Method, Clib.strpbrk() Method, and string.replace() Method


 Siebel eScript Language Reference 
 Published: 18 April 2003