User manual

710
mikoC PRO for dsPIC
MikroElektronika
strcspn
Prototype
char *strcspn(char * s1, char *s2);
Description Function computes the length of the maximum initial segment of the string pointed to by s1 that
consists entirely of characters that are not in the string pointed to by s2.
The function returns the length of the initial segment.
Example
char txt = “mikroElektronika”;
char txt_sub = “mikro”;
char *res;
res = strcspn(txt_sub,txt);
strpbrk
Prototype
char *strpbrk(char * s1, char *s2);
Description Function searches s1 for the rst occurrence of any character from the string s2. The terminating null
character is not included in the search. The function returns pointer to the matching character in s1. If
s1 contains no characters from s2, the function returns 0.
Example
char txt = “mikroElektronika”;
char txt_sub = “mikro”;
char *res;
res = strpbrk(txt_sub,txt);
strrchr
Prototype
char *strrchr(char * ptr, char chr);
Description Function searches the string ptr for the last occurrence of character chr. The null character
terminating ptr is not included in the search. The function returns pointer to the last chr found in
ptr; if no matching character was found, function returns 0.
Example
char txt = “mikroElektronika”;
res = strrchr(txt_sub,’k’); // returns the pointer to the ‘k’ character of
the ‘txt’ string