diff options
author | Elliott Hughes | 2017-12-20 11:41:00 -0600 |
---|---|---|
committer | Elliott Hughes | 2017-12-20 11:42:22 -0600 |
commit | 579e682628805dd9c3f8c96765c0beb3f56f1494 (patch) | |
tree | d9f77eb889f512a8a98ce9fb6826b4810bb2dc11 /base/include | |
parent | e1d9e7c343ac4577450b96d4de19da6f099eb154 (diff) | |
download | platform-system-core-579e682628805dd9c3f8c96765c0beb3f56f1494.tar.gz platform-system-core-579e682628805dd9c3f8c96765c0beb3f56f1494.tar.xz platform-system-core-579e682628805dd9c3f8c96765c0beb3f56f1494.zip |
Add std::string StartsWith*/EndsWith* overloads.
We should have done this from the beginning. Thanks to Windows, we're not
going to be able to switch libbase over to std::string_view any time soon.
Bug: N/A
Test: ran tests
Change-Id: Iff2f56986e39de53f3ac484415378af17dacf26b
Diffstat (limited to 'base/include')
-rw-r--r-- | base/include/android-base/strings.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/base/include/android-base/strings.h b/base/include/android-base/strings.h index f5f5c1139..c11acb10d 100644 --- a/base/include/android-base/strings.h +++ b/base/include/android-base/strings.h | |||
@@ -57,12 +57,18 @@ extern template std::string Join(const std::vector<std::string>&, const std::str | |||
57 | extern template std::string Join(const std::vector<const char*>&, const std::string&); | 57 | extern template std::string Join(const std::vector<const char*>&, const std::string&); |
58 | 58 | ||
59 | // Tests whether 's' starts with 'prefix'. | 59 | // Tests whether 's' starts with 'prefix'. |
60 | // TODO: string_view | ||
60 | bool StartsWith(const std::string& s, const char* prefix); | 61 | bool StartsWith(const std::string& s, const char* prefix); |
61 | bool StartsWithIgnoreCase(const std::string& s, const char* prefix); | 62 | bool StartsWithIgnoreCase(const std::string& s, const char* prefix); |
63 | bool StartsWith(const std::string& s, const std::string& prefix); | ||
64 | bool StartsWithIgnoreCase(const std::string& s, const std::string& prefix); | ||
62 | 65 | ||
63 | // Tests whether 's' ends with 'suffix'. | 66 | // Tests whether 's' ends with 'suffix'. |
67 | // TODO: string_view | ||
64 | bool EndsWith(const std::string& s, const char* suffix); | 68 | bool EndsWith(const std::string& s, const char* suffix); |
65 | bool EndsWithIgnoreCase(const std::string& s, const char* suffix); | 69 | bool EndsWithIgnoreCase(const std::string& s, const char* suffix); |
70 | bool EndsWith(const std::string& s, const std::string& prefix); | ||
71 | bool EndsWithIgnoreCase(const std::string& s, const std::string& prefix); | ||
66 | 72 | ||
67 | // Tests whether 'lhs' equals 'rhs', ignoring case. | 73 | // Tests whether 'lhs' equals 'rhs', ignoring case. |
68 | bool EqualsIgnoreCase(const std::string& lhs, const std::string& rhs); | 74 | bool EqualsIgnoreCase(const std::string& lhs, const std::string& rhs); |