SDDSlib
Loading...
Searching...
No Matches
rcdelete.c File Reference

Provides the rcdelete function for string manipulation. More...

#include "mdb.h"
#include <ctype.h>

Go to the source code of this file.

Functions

char * rcdelete (char *s, char c0, char c1)
 Deletes from a string every instance of any character between two specified ASCII characters, inclusive.
 

Detailed Description

Provides the rcdelete function for string manipulation.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Author
M. Borland, C. Saunders, R. Soliday

Definition in file rcdelete.c.

Function Documentation

◆ rcdelete()

char * rcdelete ( char * s,
char c0,
char c1 )

Deletes from a string every instance of any character between two specified ASCII characters, inclusive.

This function iterates through the input string and removes any character that falls within the specified range [c0, c1] in the ASCII table.

Parameters
sThe input string to be modified.
c0The lower bound character in the ASCII range.
c1The upper bound character in the ASCII range.
Returns
The modified string with specified characters removed.

Definition at line 29 of file rcdelete.c.

29 {
30 register char *ptr0, *ptr1;
31
32 ptr0 = ptr1 = s;
33 while (*ptr1) {
34 if (*ptr1 < c0 || *ptr1 > c1)
35 *ptr0++ = *ptr1++;
36 else
37 ptr1++;
38 }
39 *ptr0 = 0;
40 return (s);
41}