| 511 | |
| 512 | template<class StringType> |
| 513 | void DoReplaceSubstringsAfterOffset(StringType* str, |
| 514 | size_t start_offset, |
| 515 | const StringType& find_this, |
| 516 | const StringType& replace_with, |
| 517 | bool replace_all) { |
| 518 | if ((start_offset == StringType::npos) || (start_offset >= str->length())) |
| 519 | return; |
| 520 | |
| 521 | DCHECK(!find_this.empty()); |
| 522 | for (size_t offs(str->find(find_this, start_offset)); |
| 523 | offs != StringType::npos; offs = str->find(find_this, offs)) { |
| 524 | str->replace(offs, find_this.length(), replace_with); |
| 525 | offs += replace_with.length(); |
| 526 | |
| 527 | if (!replace_all) |
| 528 | break; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | void ReplaceFirstSubstringAfterOffset(string16* str, |
| 533 | size_t start_offset, |
no test coverage detected