Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: base/strings/string_util.h

Issue 1233453011: Revert of Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/android/library_loader/library_prefetcher.cc ('k') | base/strings/string_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file defines utility functions for working with strings. 5 // This file defines utility functions for working with strings.
6 6
7 #ifndef BASE_STRINGS_STRING_UTIL_H_ 7 #ifndef BASE_STRINGS_STRING_UTIL_H_
8 #define BASE_STRINGS_STRING_UTIL_H_ 8 #define BASE_STRINGS_STRING_UTIL_H_
9 9
10 #include <ctype.h> 10 #include <ctype.h>
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 // DEPRECATED. Returns true if str starts/ends with search, or false otherwise. 375 // DEPRECATED. Returns true if str starts/ends with search, or false otherwise.
376 // TODO(brettw) remove in favor of the "enum" versions above. 376 // TODO(brettw) remove in favor of the "enum" versions above.
377 inline bool StartsWithASCII(const std::string& str, 377 inline bool StartsWithASCII(const std::string& str,
378 const std::string& search, 378 const std::string& search,
379 bool case_sensitive) { 379 bool case_sensitive) {
380 return StartsWith(StringPiece(str), StringPiece(search), 380 return StartsWith(StringPiece(str), StringPiece(search),
381 case_sensitive ? CompareCase::SENSITIVE 381 case_sensitive ? CompareCase::SENSITIVE
382 : CompareCase::INSENSITIVE_ASCII); 382 : CompareCase::INSENSITIVE_ASCII);
383 } 383 }
384 BASE_EXPORT bool StartsWith(const string16& str,
385 const string16& search,
386 bool case_sensitive);
387 inline bool EndsWith(const std::string& str,
388 const std::string& search,
389 bool case_sensitive) {
390 return EndsWith(StringPiece(str), StringPiece(search),
391 case_sensitive ? CompareCase::SENSITIVE
392 : CompareCase::INSENSITIVE_ASCII);
393 }
394 BASE_EXPORT bool EndsWith(const string16& str,
395 const string16& search,
396 bool case_sensitive);
384 397
385 // Determines the type of ASCII character, independent of locale (the C 398 // Determines the type of ASCII character, independent of locale (the C
386 // library versions will change based on locale). 399 // library versions will change based on locale).
387 template <typename Char> 400 template <typename Char>
388 inline bool IsAsciiWhitespace(Char c) { 401 inline bool IsAsciiWhitespace(Char c) {
389 return c == ' ' || c == '\r' || c == '\n' || c == '\t'; 402 return c == ' ' || c == '\r' || c == '\n' || c == '\t';
390 } 403 }
391 template <typename Char> 404 template <typename Char>
392 inline bool IsAsciiAlpha(Char c) { 405 inline bool IsAsciiAlpha(Char c) {
393 return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')); 406 return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 520
508 #if defined(OS_WIN) 521 #if defined(OS_WIN)
509 #include "base/strings/string_util_win.h" 522 #include "base/strings/string_util_win.h"
510 #elif defined(OS_POSIX) 523 #elif defined(OS_POSIX)
511 #include "base/strings/string_util_posix.h" 524 #include "base/strings/string_util_posix.h"
512 #else 525 #else
513 #error Define string operations appropriately for your platform 526 #error Define string operations appropriately for your platform
514 #endif 527 #endif
515 528
516 #endif // BASE_STRINGS_STRING_UTIL_H_ 529 #endif // BASE_STRINGS_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « base/android/library_loader/library_prefetcher.cc ('k') | base/strings/string_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698