summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-04-26 11:17:53 -0400
committerNat Goodspeed <nat@lindenlab.com>2019-04-26 11:17:53 -0400
commit0d596aa4de2f583862274350ce6287c0ed8c2bec (patch)
tree90a6ca5b29d5c99b585233d059e16dccc23a2e19 /indra/llcommon/llstring.h
parent70aa89f708254c47766f4629e9131ea492829129 (diff)
parent85b431d5137886927efef35ca558bc8a998a5212 (diff)
Automated merge with file:///Users/nat/linden/viewer-gridselect
Diffstat (limited to 'indra/llcommon/llstring.h')
-rw-r--r--indra/llcommon/llstring.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 30bec3a6f8..b619a9e48c 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -1735,7 +1735,8 @@ bool LLStringUtilBase<T>::startsWith(
const string_type& substr)
{
if(string.empty() || (substr.empty())) return false;
- if(0 == string.find(substr)) return true;
+ if (substr.length() > string.length()) return false;
+ if (0 == string.compare(0, substr.length(), substr)) return true;
return false;
}
@@ -1746,9 +1747,11 @@ bool LLStringUtilBase<T>::endsWith(
const string_type& substr)
{
if(string.empty() || (substr.empty())) return false;
- std::string::size_type idx = string.rfind(substr);
- if(std::string::npos == idx) return false;
- return (idx == (string.size() - substr.size()));
+ size_t sub_len = substr.length();
+ size_t str_len = string.length();
+ if (sub_len > str_len) return false;
+ if (0 == string.compare(str_len - sub_len, sub_len, substr)) return true;
+ return false;
}
// static