SDDSlib
Loading...
Searching...
No Matches
SDDS
mdblib
rcdelete.c
Go to the documentation of this file.
1
/**
2
* @file rcdelete.c
3
* @brief Provides the rcdelete function for string manipulation.
4
*
5
* @copyright
6
* - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
7
* - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
8
*
9
* @license
10
* This file is distributed under the terms of the Software License Agreement
11
* found in the file LICENSE included with this distribution.
12
*
13
* @author M. Borland, C. Saunders, R. Soliday
14
*/
15
16
#include "mdb.h"
17
#include <ctype.h>
18
19
/**
20
* @brief Deletes from a string every instance of any character between two specified ASCII characters, inclusive.
21
*
22
* This function iterates through the input string and removes any character that falls within the specified range [c0, c1] in the ASCII table.
23
*
24
* @param s The input string to be modified.
25
* @param c0 The lower bound character in the ASCII range.
26
* @param c1 The upper bound character in the ASCII range.
27
* @return The modified string with specified characters removed.
28
*/
29
char
*
rcdelete
(
char
*s,
char
c0,
char
c1) {
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
}
rcdelete
char * rcdelete(char *s, char c0, char c1)
Deletes from a string every instance of any character between two specified ASCII characters,...
Definition
rcdelete.c:29
Generated by
1.12.0