Last change
on this file since 0580615 was 0580615, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Point of no return.
|
-
Property mode
set to
100644
|
File size:
721 bytes
|
Rev | Line | |
---|
[f40a309] | 1 | /*
|
---|
| 2 | ============================================================================
|
---|
| 3 | strcspn.c -- character scan function ala' Unix(tm)
|
---|
| 4 | Version 1 -- 1987-02-11 -- D.N. Lynx Crowe
|
---|
| 5 |
|
---|
| 6 | Return the number of characters in the maximum leading segment
|
---|
| 7 | of string which consists solely of characters NOT from charset.
|
---|
| 8 | ============================================================================
|
---|
| 9 | */
|
---|
| 10 |
|
---|
[0580615] | 11 | int strcspn(char *string, char *charset)
|
---|
[f40a309] | 12 | {
|
---|
| 13 | register char *p, *q;
|
---|
| 14 | register int n = 0;
|
---|
| 15 |
|
---|
| 16 | for(q = string; *q != '\0'; ++q , ++n) {
|
---|
| 17 |
|
---|
| 18 | for(p = charset; *p != '\0' && *p != *q; ++p)
|
---|
| 19 | ;
|
---|
| 20 |
|
---|
| 21 | if(*p != '\0')
|
---|
| 22 | break;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | return(n);
|
---|
| 26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.