OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_STRING_UTIL_H_ | 7 #ifndef BASE_STRING_UTIL_H_ |
8 #define BASE_STRING_UTIL_H_ | 8 #define BASE_STRING_UTIL_H_ |
9 | 9 |
10 #include <stdarg.h> // va_list | 10 #include <stdarg.h> // va_list |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 512 } |
513 }; | 513 }; |
514 | 514 |
515 template<typename Char> struct CaseInsensitiveCompareASCII { | 515 template<typename Char> struct CaseInsensitiveCompareASCII { |
516 public: | 516 public: |
517 bool operator()(Char x, Char y) const { | 517 bool operator()(Char x, Char y) const { |
518 return ToLowerASCII(x) == ToLowerASCII(y); | 518 return ToLowerASCII(x) == ToLowerASCII(y); |
519 } | 519 } |
520 }; | 520 }; |
521 | 521 |
| 522 // TODO(timsteele): Move these split string functions into their own API on |
| 523 // string_split.cc/.h files. |
522 //----------------------------------------------------------------------------- | 524 //----------------------------------------------------------------------------- |
523 | 525 |
524 // Splits |str| into a vector of strings delimited by |s|. Append the results | 526 // Splits |str| into a vector of strings delimited by |s|. Append the results |
525 // into |r| as they appear. If several instances of |s| are contiguous, or if | 527 // into |r| as they appear. If several instances of |s| are contiguous, or if |
526 // |str| begins with or ends with |s|, then an empty string is inserted. | 528 // |str| begins with or ends with |s|, then an empty string is inserted. |
527 // | 529 // |
528 // Every substring is trimmed of any leading or trailing white space. | 530 // Every substring is trimmed of any leading or trailing white space. |
529 void SplitString(const std::wstring& str, | 531 void SplitString(const std::wstring& str, |
530 wchar_t s, | 532 wchar_t s, |
531 std::vector<std::wstring>* r); | 533 std::vector<std::wstring>* r); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 #elif defined(WCHAR_T_IS_UTF32) | 632 #elif defined(WCHAR_T_IS_UTF32) |
631 typedef uint32 Unsigned; | 633 typedef uint32 Unsigned; |
632 #endif | 634 #endif |
633 }; | 635 }; |
634 template<> | 636 template<> |
635 struct ToUnsigned<short> { | 637 struct ToUnsigned<short> { |
636 typedef unsigned short Unsigned; | 638 typedef unsigned short Unsigned; |
637 }; | 639 }; |
638 | 640 |
639 #endif // BASE_STRING_UTIL_H_ | 641 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |