diff options
author | Elliott Hughes <enh@google.com> | 2019-05-03 09:02:45 -0700 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-13 23:30:46 +0100 |
commit | 124e1a0ea611be51c8b514e663c4528f10e032bc (patch) | |
tree | 68c26e60b8859867dff7a61b85748e4ec8412253 /adb/adb_utils.h | |
parent | a9981a8f6f58dc42a69b4f7e6d441def5dbd84e0 (diff) | |
download | system_core-124e1a0ea611be51c8b514e663c4528f10e032bc.tar.gz system_core-124e1a0ea611be51c8b514e663c4528f10e032bc.tar.bz2 system_core-124e1a0ea611be51c8b514e663c4528f10e032bc.zip |
libbase: add ConsumePrefix/ConsumeSuffix.
adb was already using ConsumePrefix, and now we have another would-be
user in cutils. (There appears to be one place in adb that should use
ConsumeSuffix, so I'm assuming we'll want that sooner or later.)
I've kept these inline because adb and google3's versions both were, and
I'm easily led.
Test: treehugger
Change-Id: I29d99032f6f6ccbfaefece59725db8afb02a4c87
Diffstat (limited to 'adb/adb_utils.h')
-rw-r--r-- | adb/adb_utils.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/adb/adb_utils.h b/adb/adb_utils.h index 5800a62f7..8b0dcee83 100644 --- a/adb/adb_utils.h +++ b/adb/adb_utils.h @@ -141,11 +141,3 @@ inline bool ParseUint(T* result, std::string_view str, std::string_view* remaini return true; } - -inline bool ConsumePrefix(std::string_view* str, std::string_view prefix) { - if (str->starts_with(prefix)) { - str->remove_prefix(prefix.size()); - return true; - } - return false; -} |