Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: base/string_util.h

Issue 10828217: string_util support for joining strings using strings not just chars. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: string_util support for joining strings on strings in addition to chars. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/string_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | base/string_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698