Last change
on this file since 2 was 2, checked in by root, 23 years ago |
Initial revision
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
594 bytes
|
Rev | Line | |
---|
[2] | 1 | #include <os2.h>
|
---|
| 2 | #include <stdlib.h>
|
---|
| 3 | #include <string.h>
|
---|
| 4 | #include <ctype.h>
|
---|
| 5 |
|
---|
| 6 | #pragma alloc_text(MISC8,strip_trail_char,strip_lead_char)
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | char * strip_trail_char (char *strip,char *a) {
|
---|
| 10 |
|
---|
| 11 | register char *p;
|
---|
| 12 |
|
---|
| 13 | if(a && *a && strip && *strip) {
|
---|
| 14 | p = &a[strlen(a) - 1];
|
---|
| 15 | while (*a && strchr(strip,*p) != NULL) {
|
---|
| 16 | *p = 0;
|
---|
| 17 | p--;
|
---|
| 18 | }
|
---|
| 19 | }
|
---|
| 20 | return a;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | char * strip_lead_char (char *strip,char *a) {
|
---|
| 24 |
|
---|
| 25 | register char *p = a;
|
---|
| 26 |
|
---|
| 27 | if(a && *a && strip && *strip) {
|
---|
| 28 | while(*p && strchr(strip,*p) != NULL)
|
---|
| 29 | p++;
|
---|
| 30 | if(p != a)
|
---|
| 31 | memmove(a,p,strlen(p) + 1);
|
---|
| 32 | }
|
---|
| 33 | return a;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.