summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-07-08 19:21:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-08 17:33:57 +0000
commite8eb7a885e574858ddfe3dfd836fbe9ce62f92b8 (patch)
treecc156249deb25c2a8763a00f706662c91acbca64 /media
parent0832b2d7d190f4fbe6f134446b2610df0cccdbbb (diff)
parent3c1da7224155516a08d94598eb64b64204bf10f8 (diff)
downloadframeworks_av-e8eb7a885e574858ddfe3dfd836fbe9ce62f92b8.zip
frameworks_av-e8eb7a885e574858ddfe3dfd836fbe9ce62f92b8.tar.gz
frameworks_av-e8eb7a885e574858ddfe3dfd836fbe9ce62f92b8.tar.bz2
Merge "AString: add startsWithIgnoreCase and endsWithIgnoreCase"
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/foundation/AString.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/media/libstagefright/foundation/AString.cpp b/media/libstagefright/foundation/AString.cpp
index f2d501e..894f65c 100644
--- a/media/libstagefright/foundation/AString.cpp
+++ b/media/libstagefright/foundation/AString.cpp
@@ -328,6 +328,20 @@ bool AString::endsWith(const char *suffix) const {
return !strcmp(mData + mSize - suffixLen, suffix);
}
+bool AString::startsWithIgnoreCase(const char *prefix) const {
+ return !strncasecmp(mData, prefix, strlen(prefix));
+}
+
+bool AString::endsWithIgnoreCase(const char *suffix) const {
+ size_t suffixLen = strlen(suffix);
+
+ if (mSize < suffixLen) {
+ return false;
+ }
+
+ return !strcasecmp(mData + mSize - suffixLen, suffix);
+}
+
AString StringPrintf(const char *format, ...) {
va_list ap;
va_start(ap, format);