OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <stdarg.h> // va_list | 10 #include <stdarg.h> // va_list |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 void SplitStringAlongWhitespace(const std::string& str, | 543 void SplitStringAlongWhitespace(const std::string& str, |
544 std::vector<std::string>* result); | 544 std::vector<std::string>* result); |
545 | 545 |
546 // Replace $1-$2-$3..$9 in the format string with |a|-|b|-|c|..|i| respectively. | 546 // Replace $1-$2-$3..$9 in the format string with |a|-|b|-|c|..|i| respectively. |
547 // Additionally, $$ is replaced by $. The offsets parameter here can | 547 // Additionally, $$ is replaced by $. The offsets parameter here can |
548 // be NULL. This only allows you to use up to nine replacements. | 548 // be NULL. This only allows you to use up to nine replacements. |
549 string16 ReplaceStringPlaceholders(const string16& format_string, | 549 string16 ReplaceStringPlaceholders(const string16& format_string, |
550 const std::vector<string16>& subst, | 550 const std::vector<string16>& subst, |
551 std::vector<size_t>* offsets); | 551 std::vector<size_t>* offsets); |
552 | 552 |
553 std::string ReplaceStringPlaceholders(const std::string& format_string, | 553 std::string ReplaceStringPlaceholders(const base::StringPiece& format_string, |
554 const std::vector<std::string>& subst, | 554 const std::vector<std::string>& subst, |
555 std::vector<size_t>* offsets); | 555 std::vector<size_t>* offsets); |
556 | 556 |
557 // Single-string shortcut for ReplaceStringHolders. | 557 // Single-string shortcut for ReplaceStringHolders. |
558 string16 ReplaceStringPlaceholders(const string16& format_string, | 558 string16 ReplaceStringPlaceholders(const string16& format_string, |
559 const string16& a, | 559 const string16& a, |
560 size_t* offset); | 560 size_t* offset); |
561 | 561 |
562 // If the size of |input| is more than |max_len|, this function returns true and | 562 // If the size of |input| is more than |max_len|, this function returns true and |
563 // |input| is shortened into |output| by removing chars in the middle (they are | 563 // |input| is shortened into |output| by removing chars in the middle (they are |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 #elif defined(WCHAR_T_IS_UTF32) | 607 #elif defined(WCHAR_T_IS_UTF32) |
608 typedef uint32 Unsigned; | 608 typedef uint32 Unsigned; |
609 #endif | 609 #endif |
610 }; | 610 }; |
611 template<> | 611 template<> |
612 struct ToUnsigned<short> { | 612 struct ToUnsigned<short> { |
613 typedef unsigned short Unsigned; | 613 typedef unsigned short Unsigned; |
614 }; | 614 }; |
615 | 615 |
616 #endif // BASE_STRING_UTIL_H_ | 616 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |