Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object String Methods >
This method searches a string for characters that are not among a group of specified characters.
A literal string, or a variable containing a string, to be searched
A literal string, or a variable containing a string, which contains the set of characters to search for
If all matching characters are found, the length of the string; otherwise, the offset of the first matching character from the beginning of string.
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.
The following fragment demonstrates Clib.strcspn(). When searching
string, it returns the position of the
w, 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:
strspn returns an integer: 23