summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2017-12-20 11:41:00 -0600
committerElliott Hughes2017-12-20 11:42:22 -0600
commit579e682628805dd9c3f8c96765c0beb3f56f1494 (patch)
treed9f77eb889f512a8a98ce9fb6826b4810bb2dc11 /base/include
parente1d9e7c343ac4577450b96d4de19da6f099eb154 (diff)
downloadplatform-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.h6
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
57extern template std::string Join(const std::vector<const char*>&, const std::string&); 57extern 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
60bool StartsWith(const std::string& s, const char* prefix); 61bool StartsWith(const std::string& s, const char* prefix);
61bool StartsWithIgnoreCase(const std::string& s, const char* prefix); 62bool StartsWithIgnoreCase(const std::string& s, const char* prefix);
63bool StartsWith(const std::string& s, const std::string& prefix);
64bool 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
64bool EndsWith(const std::string& s, const char* suffix); 68bool EndsWith(const std::string& s, const char* suffix);
65bool EndsWithIgnoreCase(const std::string& s, const char* suffix); 69bool EndsWithIgnoreCase(const std::string& s, const char* suffix);
70bool EndsWith(const std::string& s, const std::string& prefix);
71bool 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.
68bool EqualsIgnoreCase(const std::string& lhs, const std::string& rhs); 74bool EqualsIgnoreCase(const std::string& lhs, const std::string& rhs);