OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <ctype.h> | 10 #include <ctype.h> |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 std::vector<std::string>* tokens); | 501 std::vector<std::string>* tokens); |
502 BASE_EXPORT size_t Tokenize(const base::StringPiece& str, | 502 BASE_EXPORT size_t Tokenize(const base::StringPiece& str, |
503 const base::StringPiece& delimiters, | 503 const base::StringPiece& delimiters, |
504 std::vector<base::StringPiece>* tokens); | 504 std::vector<base::StringPiece>* tokens); |
505 | 505 |
506 // Does the opposite of SplitString(). | 506 // Does the opposite of SplitString(). |
507 BASE_EXPORT string16 JoinString(const std::vector<string16>& parts, char16 s); | 507 BASE_EXPORT string16 JoinString(const std::vector<string16>& parts, char16 s); |
508 BASE_EXPORT std::string JoinString( | 508 BASE_EXPORT std::string JoinString( |
509 const std::vector<std::string>& parts, char s); | 509 const std::vector<std::string>& parts, char s); |
510 | 510 |
| 511 // Join |parts| using |separator|. |
| 512 BASE_EXPORT std::string JoinString( |
| 513 const std::vector<std::string>& parts, |
| 514 const std::string& separator); |
| 515 BASE_EXPORT string16 JoinString( |
| 516 const std::vector<string16>& parts, |
| 517 const string16& separator); |
| 518 |
511 // Replace $1-$2-$3..$9 in the format string with |a|-|b|-|c|..|i| respectively. | 519 // Replace $1-$2-$3..$9 in the format string with |a|-|b|-|c|..|i| respectively. |
512 // Additionally, any number of consecutive '$' characters is replaced by that | 520 // Additionally, any number of consecutive '$' characters is replaced by that |
513 // number less one. Eg $$->$, $$$->$$, etc. The offsets parameter here can be | 521 // number less one. Eg $$->$, $$$->$$, etc. The offsets parameter here can be |
514 // NULL. This only allows you to use up to nine replacements. | 522 // NULL. This only allows you to use up to nine replacements. |
515 BASE_EXPORT string16 ReplaceStringPlaceholders( | 523 BASE_EXPORT string16 ReplaceStringPlaceholders( |
516 const string16& format_string, | 524 const string16& format_string, |
517 const std::vector<string16>& subst, | 525 const std::vector<string16>& subst, |
518 std::vector<size_t>* offsets); | 526 std::vector<size_t>* offsets); |
519 | 527 |
520 BASE_EXPORT std::string ReplaceStringPlaceholders( | 528 BASE_EXPORT std::string ReplaceStringPlaceholders( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 #elif defined(WCHAR_T_IS_UTF32) | 567 #elif defined(WCHAR_T_IS_UTF32) |
560 typedef uint32 Unsigned; | 568 typedef uint32 Unsigned; |
561 #endif | 569 #endif |
562 }; | 570 }; |
563 template<> | 571 template<> |
564 struct ToUnsigned<short> { | 572 struct ToUnsigned<short> { |
565 typedef unsigned short Unsigned; | 573 typedef unsigned short Unsigned; |
566 }; | 574 }; |
567 | 575 |
568 #endif // BASE_STRING_UTIL_H_ | 576 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |