Strcspn, Strlen, Strcspn strlen – Zilog ZUSBOPTS User Manual
Page 473: Example, Synopsis, Returns

UM017105-0511
Standard Functions
Zilog Developer Studio II – ZNEO™
User Manual
445
Example
char s1[80], *s2;
s2=strcpy(s1,"Production");
strcspn
Computes the length of the initial segment of the string pointed to by s1 that consists
entirely of characters not from the string pointed to by s2. The terminating null character is
not considered part of s2.
Synopsis
#include
size_t strcspn(const char *s1, const char *s2);
Returns
The length of the segment.
Example
size_t pos;
char s1[]="xyzabc";
char s2[]="abc";
pos=strcspn(s1,s2);
strlen
Computes the length of the string pointed to by s.
Synopsis
#include
size_t strlen(const char *s);
Returns
The number of characters that precede the terminating null character.
Example
char s1[]="COMPASS";
size_t i;
i=strlen(s1);