diff options
author | Elliott Hughes <enh@google.com> | 2019-11-19 15:28:24 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-11-19 15:28:24 +0000 |
commit | 43f9d5f34aa7d080f8321dc35f24c0d8296c6bcc (patch) | |
tree | 07e428d298c5d8fbb9a2251aabecfaa07798dd9a /base/include/android-base/strings.h | |
parent | ba5351692e005cfa016414fb5472a2a12f95e31d (diff) | |
parent | 908e0dfda568ddf0eb7f12e555655818241acda8 (diff) |
Merge "Add absl-like StringReplace."
Diffstat (limited to 'base/include/android-base/strings.h')
-rw-r--r-- | base/include/android-base/strings.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/base/include/android-base/strings.h b/base/include/android-base/strings.h index b1c22c9f73..14d534a3b3 100644 --- a/base/include/android-base/strings.h +++ b/base/include/android-base/strings.h @@ -85,5 +85,10 @@ inline bool ConsumeSuffix(std::string_view* s, std::string_view suffix) { return true; } +// Replaces `from` with `to` in `s`, once if `all == false`, or as many times as +// there are matches if `all == true`. +[[nodiscard]] std::string StringReplace(std::string_view s, std::string_view from, + std::string_view to, bool all); + } // namespace base } // namespace android |