Replaces all occurrences of 'source' with 'dest'. Returns number of replacements made. Source and dest have to have the same length. Throws if the lengths are different. If 'source' is a pattern that is overlapping with itself, we perform sequential replacement: "aaaaaaa".replaceAll("aa", "ba") ‐‐> "bababaa"
Synopsis
Declared in <folly/Range.h>
size_t
replaceAll(
const_range_type source,
const_range_type dest);
Description
Example use:
char in[]= "buffer"; auto msp = MutableStringPiece(input); EXPECT_EQ(msp.replaceAll("ff","tt"), 1); EXPECT_EQ(msp, "butter");
Return Value
The number of replacements made.
Parameters
Name |
Description |
source |
The subrange to search for. |
dest |
The contents to write in place of each match. |
Created with MrDocs