Strcspn - Texas Instruments TI-89 Developer's Manual

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Appendix A: System Routines — Strings

strcspn

Declaration:
size_t strcspn (const char * s1 , const char * s2 )
Category(ies):
Strings
Description:
Calculates the index of the first character in string s1 that matches any of
the characters in string s2 . This value is the length of a leading substring of
the string pointed to by s1 which consists entirely of characters not in the
string pointed by s2 .
Inputs:
s1 — Character string to search.
s2 — Character set.
Outputs:
Return the length of the substring in s1 that consists entirely of characters
not found in string s2 . If string s1 contains no characters from string s2 ,
strcspn returns the length of string s1 .
Assumptions:
None
Side Effects:
None
All versions of the TI-89 / TI-92 Plus.
Availability:
TI-89 / TI-92 Plus
Differences:
None
See Also:
strspn, strpbrk, strchr, strrchr, strstr, memchr
Example:
BOOL ck_vowel( const char *str1, size_t *lenp )
/* ck_vowel - Determine the length of a leading substring of a string that
contains no vowels.
input:
returns TRUE if str1 contains a vowel, else FALSE
*/
{
if( ( *lenp = strcspn(str1, "aeiou")) == strlen(str1) )
return( FALSE );
else
return( TRUE );
}
TI-89 / TI-92 Plus Developer Guide
str1 = string to search
lenp = ptr to location to return length of substring
/* no vowels in str1 */
/* str1 contains a vowel after *lenp nonvowels */
Not for Distribution
993
Beta Version January 26, 2001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents