| 80 | } |
| 81 | |
| 82 | size_t ReplaceAllChars(std::string* s, const StringPiece& from, char to) |
| 83 | { |
| 84 | size_t num_replaced = 0; |
| 85 | size_t length = s->length(); |
| 86 | for (size_t i = 0; i < length; ++i) |
| 87 | { |
| 88 | if (from.find((*s)[i]) != std::string::npos) |
| 89 | { |
| 90 | (*s)[i] = to; |
| 91 | ++num_replaced; |
| 92 | } |
| 93 | } |
| 94 | return num_replaced; |
| 95 | } |
| 96 | |
| 97 | std::string ReplaceAllChars(const StringPiece& s, const StringPiece& from, char to) |
| 98 | { |