| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/strings/string_util.h" | 5 #include "base/strings/string_util.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <math.h> | 9 #include <math.h> |
| 10 #include <stdarg.h> | 10 #include <stdarg.h> |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 469 } |
| 470 return a_begin == a_end && b_begin == b_end; | 470 return a_begin == a_end && b_begin == b_end; |
| 471 } | 471 } |
| 472 | 472 |
| 473 bool LowerCaseEqualsASCII(const char16* a_begin, | 473 bool LowerCaseEqualsASCII(const char16* a_begin, |
| 474 const char16* a_end, | 474 const char16* a_end, |
| 475 const char* b) { | 475 const char* b) { |
| 476 return DoLowerCaseEqualsASCII(a_begin, a_end, b); | 476 return DoLowerCaseEqualsASCII(a_begin, a_end, b); |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace base | 479 bool EqualsASCII(const string16& a, const StringPiece& b) { |
| 480 | |
| 481 bool EqualsASCII(const string16& a, const base::StringPiece& b) { | |
| 482 if (a.length() != b.length()) | 480 if (a.length() != b.length()) |
| 483 return false; | 481 return false; |
| 484 return std::equal(b.begin(), b.end(), a.begin()); | 482 return std::equal(b.begin(), b.end(), a.begin()); |
| 485 } | 483 } |
| 486 | 484 |
| 485 } // namespace base |
| 486 |
| 487 bool StartsWithASCII(const std::string& str, | 487 bool StartsWithASCII(const std::string& str, |
| 488 const std::string& search, | 488 const std::string& search, |
| 489 bool case_sensitive) { | 489 bool case_sensitive) { |
| 490 if (case_sensitive) | 490 if (case_sensitive) |
| 491 return str.compare(0, search.length(), search) == 0; | 491 return str.compare(0, search.length(), search) == 0; |
| 492 else | 492 else |
| 493 return base::strncasecmp(str.c_str(), search.c_str(), search.length()) == 0; | 493 return base::strncasecmp(str.c_str(), search.c_str(), search.length()) == 0; |
| 494 } | 494 } |
| 495 | 495 |
| 496 template <typename STR> | 496 template <typename STR> |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 } // namespace | 1039 } // namespace |
| 1040 | 1040 |
| 1041 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 1041 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
| 1042 return lcpyT<char>(dst, src, dst_size); | 1042 return lcpyT<char>(dst, src, dst_size); |
| 1043 } | 1043 } |
| 1044 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1044 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
| 1045 return lcpyT<wchar_t>(dst, src, dst_size); | 1045 return lcpyT<wchar_t>(dst, src, dst_size); |
| 1046 } | 1046 } |
| OLD | NEW |