Logo Search packages:      
Sourcecode: wvstreams version File versions

void replace_char ( void *  string,
char  c1,
char  c2,
int  length 

Replace all instances of c1 with c2 for the first 'length' characters in 'string'. Ignores terminating NULL, so make sure you set 'length' correctly.

Definition at line 171 of file strutils.cc.

References replace_char().

Referenced by replace_char().

    char *string = (char *)_string;
    for (int i=0; i < length; i++)
      if (*(string+i) == c1)
          *(string+i) = c2;

Generated by  Doxygen 1.6.0   Back to index