Strspn - 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

strspn

Declaration:
size_t strspn (const char * s1 , const char * s2 )
Category(ies):
Strings
Description:
Calculates the length of a leading substring of the string pointed to by s1 ,
which consists entirely of characters in the string pointed to by s2 .
s1 — Character string to search.
Inputs:
s2 — Character set.
Returns the length of the leading substring in s1 that consists entirely of
Outputs:
characters in string s2 . If s1 contains no characters from s2 , zero is
returned.
Assumptions:
None
Side Effects:
None
Availability:
All versions of the TI-89 / TI-92 Plus.
TI-89 / TI-92 Plus
Differences:
None
See Also:
strcspn, strpbrk, strchr, strrchr, strstr, memchr
Example:
BOOL ck_octal( const char *str1, size_t *lenp )
/* ck_octal - Determine the length of a leading substring of a string that
consists of octal digits.
input:
returns TRUE if str1 contains only octal digits, else FALSE
*/
{
if( ( *lenp = strspn(str1, "01234567")) == 0 )
return( FALSE ); /* no octal digits in str1
else if( *lenp == strlen(str1) )
return( TRUE );
else
return( FALSE ); /* the first *lenp digits of str1 are octal
}
TI-89 / TI-92 Plus Developer Guide
str1 = string to search
lenp = ptr to location to return length of substring
/* str1 consists entirely of octal digits
Not for Distribution
*/
*/
*/
Beta Version January 26, 2001
1001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents