beautypg.com

Strcspn, Strlen, Strcspn strlen – Zilog Z8F0130 User Manual

Page 490

background image

Appendix B. C Standard Library

UM013037-1212

466

Zilog Developer Studio II – Z8 Encore!
User Manual

Synopsis

#include

char *strcpy(char *s1, char *s2);

Returns

The value of s1.

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(char *s1, char *s2);

Returns

The length of the segment.

Example

int 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(char *s);

Returns

The number of characters that precede the terminating null character.