Siebel eScript Language Reference > C Language Library Reference > Clib String Methods >

Clib Search String for Character Method


The Clib Search String for Character method searches a string for a character that you specify. It returns one of the following values:

  • If it finds the character, then it returns the offset of the first occurrence of the character that you specify in the char argument. This offset is the number of characters in the string from the beginning to the first occurrence, starting with 0.
  • If it does not find the character, then it returns the following value:

    Null

It is recommended that you use the Clib Search String for Character method only if you cannot use the equivalent standard JavaScript method.

Format

Clib.strchr(string, char)

Table 159 describes the arguments for the Clib Search String for Character method.

Table 159. Arguments for the Clib Search String for Character Method
Argument
Description

string

A string literal or a string variable that contains the character for which this method searches.

char

The character for which this method searches.

Example

The following example uses the Clib Search String for Character method:

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

This example products the following results:

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

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.