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

Side by Side Diff: base/strings/string_util.h

Issue 2691193002: Added StringPiece overloads for base::JoinString. (Closed)
Patch Set: Created 3 years, 10 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/strings/string_util.cc » ('j') | base/strings/string_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_STRINGS_STRING_UTIL_H_ 7 #ifndef BASE_STRINGS_STRING_UTIL_H_
8 #define BASE_STRINGS_STRING_UTIL_H_ 8 #define BASE_STRINGS_STRING_UTIL_H_
9 9
10 #include <ctype.h> 10 #include <ctype.h>
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // immediately write over this memory, but there is no other way to set the size 422 // immediately write over this memory, but there is no other way to set the size
423 // of the string, and not doing that will mean people who access |str| rather 423 // of the string, and not doing that will mean people who access |str| rather
424 // than str.c_str() will get back a string of whatever size |str| had on entry 424 // than str.c_str() will get back a string of whatever size |str| had on entry
425 // to this function (probably 0). 425 // to this function (probably 0).
426 BASE_EXPORT char* WriteInto(std::string* str, size_t length_with_null); 426 BASE_EXPORT char* WriteInto(std::string* str, size_t length_with_null);
427 BASE_EXPORT char16* WriteInto(string16* str, size_t length_with_null); 427 BASE_EXPORT char16* WriteInto(string16* str, size_t length_with_null);
428 #ifndef OS_WIN 428 #ifndef OS_WIN
429 BASE_EXPORT wchar_t* WriteInto(std::wstring* str, size_t length_with_null); 429 BASE_EXPORT wchar_t* WriteInto(std::wstring* str, size_t length_with_null);
430 #endif 430 #endif
431 431
432 // Does the opposite of SplitString(). 432 // Does the opposite of SplitString().
danakj 2017/02/16 16:34:32 and SplitStringPiece()
Matt Giuca 2017/02/17 06:09:59 Done.
433 BASE_EXPORT std::string JoinString(const std::vector<std::string>& parts, 433 BASE_EXPORT std::string JoinString(const std::vector<std::string>& parts,
434 StringPiece separator); 434 StringPiece separator);
435 BASE_EXPORT string16 JoinString(const std::vector<string16>& parts, 435 BASE_EXPORT string16 JoinString(const std::vector<string16>& parts,
436 StringPiece16 separator); 436 StringPiece16 separator);
437 BASE_EXPORT std::string JoinStringPiece(const std::vector<StringPiece>& parts,
438 StringPiece separator);
439 BASE_EXPORT string16 JoinStringPiece(const std::vector<StringPiece16>& parts,
440 StringPiece16 separator);
437 441
438 // Replace $1-$2-$3..$9 in the format string with values from |subst|. 442 // Replace $1-$2-$3..$9 in the format string with values from |subst|.
439 // Additionally, any number of consecutive '$' characters is replaced by that 443 // Additionally, any number of consecutive '$' characters is replaced by that
440 // number less one. Eg $$->$, $$$->$$, etc. The offsets parameter here can be 444 // number less one. Eg $$->$, $$$->$$, etc. The offsets parameter here can be
441 // NULL. This only allows you to use up to nine replacements. 445 // NULL. This only allows you to use up to nine replacements.
442 BASE_EXPORT string16 ReplaceStringPlaceholders( 446 BASE_EXPORT string16 ReplaceStringPlaceholders(
443 const string16& format_string, 447 const string16& format_string,
444 const std::vector<string16>& subst, 448 const std::vector<string16>& subst,
445 std::vector<size_t>* offsets); 449 std::vector<size_t>* offsets);
446 450
(...skipping 11 matching lines...) Expand all
458 462
459 #if defined(OS_WIN) 463 #if defined(OS_WIN)
460 #include "base/strings/string_util_win.h" 464 #include "base/strings/string_util_win.h"
461 #elif defined(OS_POSIX) 465 #elif defined(OS_POSIX)
462 #include "base/strings/string_util_posix.h" 466 #include "base/strings/string_util_posix.h"
463 #else 467 #else
464 #error Define string operations appropriately for your platform 468 #error Define string operations appropriately for your platform
465 #endif 469 #endif
466 470
467 #endif // BASE_STRINGS_STRING_UTIL_H_ 471 #endif // BASE_STRINGS_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/strings/string_util.cc » ('j') | base/strings/string_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698