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 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 void SplitStringDontTrim(const std::wstring& str, | 527 void SplitStringDontTrim(const std::wstring& str, |
528 wchar_t s, | 528 wchar_t s, |
529 std::vector<std::wstring>* r); | 529 std::vector<std::wstring>* r); |
530 void SplitStringDontTrim(const string16& str, | 530 void SplitStringDontTrim(const string16& str, |
531 char16 s, | 531 char16 s, |
532 std::vector<string16>* r); | 532 std::vector<string16>* r); |
533 void SplitStringDontTrim(const std::string& str, | 533 void SplitStringDontTrim(const std::string& str, |
534 char s, | 534 char s, |
535 std::vector<std::string>* r); | 535 std::vector<std::string>* r); |
536 | 536 |
537 // The same as SplitString, but use a substring delimiter instead of a char. | |
538 void SplitStringUsingSubstr(const string16& str, | |
539 const string16& s, | |
540 std::vector<string16>* r); | |
541 void SplitStringUsingSubstr(const std::string& str, | |
542 const std::string& s, | |
543 std::vector<std::string>* r); | |
544 | |
545 // Splits a string into its fields delimited by any of the characters in | 537 // Splits a string into its fields delimited by any of the characters in |
546 // |delimiters|. Each field is added to the |tokens| vector. Returns the | 538 // |delimiters|. Each field is added to the |tokens| vector. Returns the |
547 // number of tokens found. | 539 // number of tokens found. |
548 size_t Tokenize(const std::wstring& str, | 540 size_t Tokenize(const std::wstring& str, |
549 const std::wstring& delimiters, | 541 const std::wstring& delimiters, |
550 std::vector<std::wstring>* tokens); | 542 std::vector<std::wstring>* tokens); |
551 size_t Tokenize(const string16& str, | 543 size_t Tokenize(const string16& str, |
552 const string16& delimiters, | 544 const string16& delimiters, |
553 std::vector<string16>* tokens); | 545 std::vector<string16>* tokens); |
554 size_t Tokenize(const std::string& str, | 546 size_t Tokenize(const std::string& str, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 #elif defined(WCHAR_T_IS_UTF32) | 625 #elif defined(WCHAR_T_IS_UTF32) |
634 typedef uint32 Unsigned; | 626 typedef uint32 Unsigned; |
635 #endif | 627 #endif |
636 }; | 628 }; |
637 template<> | 629 template<> |
638 struct ToUnsigned<short> { | 630 struct ToUnsigned<short> { |
639 typedef unsigned short Unsigned; | 631 typedef unsigned short Unsigned; |
640 }; | 632 }; |
641 | 633 |
642 #endif // BASE_STRING_UTIL_H_ | 634 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |