OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 void SplitStringDontTrim(const std::wstring& str, | 568 void SplitStringDontTrim(const std::wstring& str, |
569 wchar_t s, | 569 wchar_t s, |
570 std::vector<std::wstring>* r); | 570 std::vector<std::wstring>* r); |
571 void SplitStringDontTrim(const string16& str, | 571 void SplitStringDontTrim(const string16& str, |
572 char16 s, | 572 char16 s, |
573 std::vector<string16>* r); | 573 std::vector<string16>* r); |
574 void SplitStringDontTrim(const std::string& str, | 574 void SplitStringDontTrim(const std::string& str, |
575 char s, | 575 char s, |
576 std::vector<std::string>* r); | 576 std::vector<std::string>* r); |
577 | 577 |
578 // The same as SplitString, but use a substring delimiter instead of a char. | |
579 void SplitStringUsingSubstr(const string16& str, | |
580 const string16& s, | |
581 std::vector<string16>* r); | |
582 void SplitStringUsingSubstr(const std::string& str, | |
583 const std::string& s, | |
584 std::vector<std::string>* r); | |
585 | |
586 // Splits a string into its fields delimited by any of the characters in | 578 // Splits a string into its fields delimited by any of the characters in |
587 // |delimiters|. Each field is added to the |tokens| vector. Returns the | 579 // |delimiters|. Each field is added to the |tokens| vector. Returns the |
588 // number of tokens found. | 580 // number of tokens found. |
589 size_t Tokenize(const std::wstring& str, | 581 size_t Tokenize(const std::wstring& str, |
590 const std::wstring& delimiters, | 582 const std::wstring& delimiters, |
591 std::vector<std::wstring>* tokens); | 583 std::vector<std::wstring>* tokens); |
592 size_t Tokenize(const string16& str, | 584 size_t Tokenize(const string16& str, |
593 const string16& delimiters, | 585 const string16& delimiters, |
594 std::vector<string16>* tokens); | 586 std::vector<string16>* tokens); |
595 size_t Tokenize(const std::string& str, | 587 size_t Tokenize(const std::string& str, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 #elif defined(WCHAR_T_IS_UTF32) | 671 #elif defined(WCHAR_T_IS_UTF32) |
680 typedef uint32 Unsigned; | 672 typedef uint32 Unsigned; |
681 #endif | 673 #endif |
682 }; | 674 }; |
683 template<> | 675 template<> |
684 struct ToUnsigned<short> { | 676 struct ToUnsigned<short> { |
685 typedef unsigned short Unsigned; | 677 typedef unsigned short Unsigned; |
686 }; | 678 }; |
687 | 679 |
688 #endif // BASE_STRING_UTIL_H_ | 680 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |