Replaces any occurrence of the characters in 'remove' with the character 'replacewith'.
| 103 | |
| 104 | // Replaces any occurrence of the characters in 'remove' with the character 'replacewith'. |
| 105 | void StripString(std::string* s, const char* remove, char replacewith) |
| 106 | { |
| 107 | const char * str_start = s->c_str(); |
| 108 | const char * str = str_start; |
| 109 | for (str = strpbrk(str, remove); str != NULL; str = strpbrk(str + 1, remove)) |
| 110 | { |
| 111 | (*s)[str - str_start] = replacewith; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | std::string StripString(const StringPiece& s, const char* remove, char replacewith) |
| 116 | { |