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

Side by Side Diff: base/string_util.h

Issue 3266013: Add unit test for ReplaceStringPlaceholders (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 3 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_unittest.cc » ('j') | base/string_util_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // characters defined by HTML 5). Each contiguous block of non-whitespace 572 // characters defined by HTML 5). Each contiguous block of non-whitespace
573 // characters is added to result. 573 // characters is added to result.
574 void SplitStringAlongWhitespace(const std::wstring& str, 574 void SplitStringAlongWhitespace(const std::wstring& str,
575 std::vector<std::wstring>* result); 575 std::vector<std::wstring>* result);
576 void SplitStringAlongWhitespace(const string16& str, 576 void SplitStringAlongWhitespace(const string16& str,
577 std::vector<string16>* result); 577 std::vector<string16>* result);
578 void SplitStringAlongWhitespace(const std::string& str, 578 void SplitStringAlongWhitespace(const std::string& str,
579 std::vector<std::string>* result); 579 std::vector<std::string>* result);
580 580
581 // Replace $1-$2-$3..$9 in the format string with |a|-|b|-|c|..|i| respectively. 581 // Replace $1-$2-$3..$9 in the format string with |a|-|b|-|c|..|i| respectively.
582 // Additionally, $$ is replaced by $. The offsets parameter here can 582 // Additionally, any number of consecutive '$' characters is replaced by that
583 // be NULL. This only allows you to use up to nine replacements. 583 // number less one. Eg $$->$, $$$->$$, etc. The offsets parameter here can be
584 // NULL. This only allows you to use up to nine replacements.
584 string16 ReplaceStringPlaceholders(const string16& format_string, 585 string16 ReplaceStringPlaceholders(const string16& format_string,
585 const std::vector<string16>& subst, 586 const std::vector<string16>& subst,
586 std::vector<size_t>* offsets); 587 std::vector<size_t>* offsets);
587 588
588 std::string ReplaceStringPlaceholders(const base::StringPiece& format_string, 589 std::string ReplaceStringPlaceholders(const base::StringPiece& format_string,
589 const std::vector<std::string>& subst, 590 const std::vector<std::string>& subst,
590 std::vector<size_t>* offsets); 591 std::vector<size_t>* offsets);
591 592
592 // Single-string shortcut for ReplaceStringHolders. 593 // Single-string shortcut for ReplaceStringHolders.
593 string16 ReplaceStringPlaceholders(const string16& format_string, 594 string16 ReplaceStringPlaceholders(const string16& format_string,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 #elif defined(WCHAR_T_IS_UTF32) 633 #elif defined(WCHAR_T_IS_UTF32)
633 typedef uint32 Unsigned; 634 typedef uint32 Unsigned;
634 #endif 635 #endif
635 }; 636 };
636 template<> 637 template<>
637 struct ToUnsigned<short> { 638 struct ToUnsigned<short> {
638 typedef unsigned short Unsigned; 639 typedef unsigned short Unsigned;
639 }; 640 };
640 641
641 #endif // BASE_STRING_UTIL_H_ 642 #endif // BASE_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/string_util_unittest.cc » ('j') | base/string_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698