Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object >
Clib.strspn() Method
This method searches a string for characters that are not among a group of specified characters.
Syntax
Clib.strspn(string, charSet)
Returns
If all matching characters are found, the length of the string; otherwise, the offset of the first matching character from the beginning of string.
Usage
This method searches the parameter string for any of the characters in the string charSet, and returns the offset of that character. The search is case-sensitive, so you may have to include both uppercase and lowercase instances of the characters to search for.
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).
Example
The following fragment demonstrates Clib.strcspn(). When searching
string
, it returns the position of thew
, counting from 0.var string = "There is more than one way to skin a cat.";
var rStrspn = Clib.strspn(string, " aeiouTthrsmn");
TheApplication().RaiseErrorText("strspn returns an integer: ");This results in the following output:
See Also
Clib.strchr() Method, Clib.strcspn() Method, Clib.strpbrk() Method, and string.replace() Method
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference Published: 18 April 2003 |