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 |
578 // Splits a string into its fields delimited by any of the characters in | 586 // Splits a string into its fields delimited by any of the characters in |
579 // |delimiters|. Each field is added to the |tokens| vector. Returns the | 587 // |delimiters|. Each field is added to the |tokens| vector. Returns the |
580 // number of tokens found. | 588 // number of tokens found. |
581 size_t Tokenize(const std::wstring& str, | 589 size_t Tokenize(const std::wstring& str, |
582 const std::wstring& delimiters, | 590 const std::wstring& delimiters, |
583 std::vector<std::wstring>* tokens); | 591 std::vector<std::wstring>* tokens); |
584 size_t Tokenize(const string16& str, | 592 size_t Tokenize(const string16& str, |
585 const string16& delimiters, | 593 const string16& delimiters, |
586 std::vector<string16>* tokens); | 594 std::vector<string16>* tokens); |
587 size_t Tokenize(const std::string& str, | 595 size_t Tokenize(const std::string& str, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 #elif defined(WCHAR_T_IS_UTF32) | 679 #elif defined(WCHAR_T_IS_UTF32) |
672 typedef uint32 Unsigned; | 680 typedef uint32 Unsigned; |
673 #endif | 681 #endif |
674 }; | 682 }; |
675 template<> | 683 template<> |
676 struct ToUnsigned<short> { | 684 struct ToUnsigned<short> { |
677 typedef unsigned short Unsigned; | 685 typedef unsigned short Unsigned; |
678 }; | 686 }; |
679 | 687 |
680 #endif // BASE_STRING_UTIL_H_ | 688 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |