Replaces all instances of 'search' with 'replace' Returns number of characters modified
| 140 | ///Replaces all instances of 'search' with 'replace' |
| 141 | ///Returns number of characters modified |
| 142 | int chr_replace(char *str, char search, char replace) { |
| 143 | unsigned int i=0,j=0; //mbg merge 7/17/06 changed to unsigned int |
| 144 | |
| 145 | while (i < strlen(str)) { |
| 146 | if (str[i] == search) { |
| 147 | str[i] = replace; |
| 148 | j++; |
| 149 | } |
| 150 | i++; |
| 151 | } |
| 152 | return j; |
| 153 | } |
| 154 | |
| 155 | |
| 156 | ///Sub-String replacement routine |