Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object String Methods > Clib.strcspn() MethodThis method searches a string for any of a group of specified characters. Syntax
ReturnsIf no matching characters are found, the length of the string; otherwise, the offset of the first matching character from the beginning of string. The return value is zero-based. The first character is zero, the second is 1, and so on. UsageThis method searches the parameter string for any of the characters in the string charSet, and returns the offset of that character. This method is similar to Clib.strpbrk(), except that Clib.strpbrk() returns the string beginning at the first character found, while Clib.strcspn() returns the offset number for that character. When possible, you should use the standard JavaScript method substring() (read string.replace() Method). ExampleThe following fragment demonstrates the difference between Clib.strcspn() and Clib.strpbrk(): var string = "There's more than one way to skin a cat."; This code results in the following output: The string is: There's more than one way to skin a cat. See AlsoClib.strchr() Method |
Siebel eScript Language Reference |