BOOTSTRAP (kutils) functions
LIBRARY ROUTINE
kstrcspn - return the number of characters not matched
LIBRARY CALL
size_t kstrcspn(
const char *istr,
const char *charset)
INPUT
- charset - The set of characters to use for counting.
OUTPUT
none
RETURN VALUE
The number of characters not matched in the input string,
from the 'charset', or 0 if the input string or character
set string are NULL.
DESCRIPTION
This function returns the length of a portion of the
input string not matching any of the characters in
specifiec set of characters. It is similiar
to the system routine strcspn().
It counts the number of characters at the start of
the input string that consist entirely of characters not in
list of characters specified by 'charset'. The
count stops at the first character in 'string' that
is in 'charset'.
ADDITIONAL INFORMATION
none
EXAMPLES
The following example uses kstrcspn() to determine
the number of non-vowels that appear before the first
vowel.
char *str = " This is my input string";
int non_vowels = 0;
non_vowels = kstrcspn(str, "aeiou");
kprintf("The number of non_vowels = %d\n", non_vowels);
The result, stored in 'non_vowels', will be 6.
SIDE EFFECTS
none
RESTRICTIONS
none
MODIFICATION
none
FILES
$BOOTSTRAP/objects/library/kutils/src/strings.c
SEE ALSO
kutils(3)
COPYRIGHT
Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.