| Index: base/strings/string_util.cc
|
| diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc
|
| index e084cb5597da6cbdcb50d0c3ce958bbc8dbc220e..77609e787d4d0575cc9ae3ffdd5c52ec1cf1471f 100644
|
| --- a/base/strings/string_util.cc
|
| +++ b/base/strings/string_util.cc
|
| @@ -1006,6 +1006,27 @@ bool MatchPattern(const string16& eval, const string16& pattern) {
|
| 0, NextCharUTF16());
|
| }
|
|
|
| +template <typename STR>
|
| +string16::size_type StartsAtT(const STR& str,
|
| + const STR& search,
|
| + bool case_sensitive) {
|
| + typename STR::const_iterator it;
|
| + if (case_sensitive) {
|
| + it = std::search(str.begin(), str.end(), search.begin(), search.end());
|
| + } else {
|
| + it = std::search(str.begin(), str.end(), search.begin(), search.end(),
|
| + base::CaseInsensitiveCompare<typename STR::value_type>());
|
| + }
|
| +
|
| + return (it != str.end()) ? std::distance(str.begin(), it) : string16::npos;
|
| +}
|
| +
|
| +string16::size_type StartsAt(const string16& str,
|
| + const string16& search,
|
| + bool case_sensitive) {
|
| + return StartsAtT(str, search, case_sensitive);
|
| +}
|
| +
|
| // The following code is compatible with the OpenBSD lcpy interface. See:
|
| // http://www.gratisoft.us/todd/papers/strlcpy.html
|
| // ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/{wcs,str}lcpy.c
|
|
|