OLD | NEW |
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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // number less one. Eg $$->$, $$$->$$, etc. The offsets parameter here can be | 575 // number less one. Eg $$->$, $$$->$$, etc. The offsets parameter here can be |
576 // NULL. This only allows you to use up to nine replacements. | 576 // NULL. This only allows you to use up to nine replacements. |
577 string16 ReplaceStringPlaceholders(const string16& format_string, | 577 string16 ReplaceStringPlaceholders(const string16& format_string, |
578 const std::vector<string16>& subst, | 578 const std::vector<string16>& subst, |
579 std::vector<size_t>* offsets); | 579 std::vector<size_t>* offsets); |
580 | 580 |
581 std::string ReplaceStringPlaceholders(const base::StringPiece& format_string, | 581 std::string ReplaceStringPlaceholders(const base::StringPiece& format_string, |
582 const std::vector<std::string>& subst, | 582 const std::vector<std::string>& subst, |
583 std::vector<size_t>* offsets); | 583 std::vector<size_t>* offsets); |
584 | 584 |
585 // Single-string shortcut for ReplaceStringHolders. | 585 // Single-string shortcut for ReplaceStringHolders. |offset| may be NULL. |
586 string16 ReplaceStringPlaceholders(const string16& format_string, | 586 string16 ReplaceStringPlaceholders(const string16& format_string, |
587 const string16& a, | 587 const string16& a, |
588 size_t* offset); | 588 size_t* offset); |
589 | 589 |
590 // If the size of |input| is more than |max_len|, this function returns true and | 590 // If the size of |input| is more than |max_len|, this function returns true and |
591 // |input| is shortened into |output| by removing chars in the middle (they are | 591 // |input| is shortened into |output| by removing chars in the middle (they are |
592 // replaced with up to 3 dots, as size permits). | 592 // replaced with up to 3 dots, as size permits). |
593 // Ex: ElideString(L"Hello", 10, &str) puts Hello in str and returns false. | 593 // Ex: ElideString(L"Hello", 10, &str) puts Hello in str and returns false. |
594 // ElideString(L"Hello my name is Tom", 10, &str) puts "Hell...Tom" in str and | 594 // ElideString(L"Hello my name is Tom", 10, &str) puts "Hell...Tom" in str and |
595 // returns true. | 595 // returns true. |
(...skipping 29 matching lines...) Expand all Loading... |
625 #elif defined(WCHAR_T_IS_UTF32) | 625 #elif defined(WCHAR_T_IS_UTF32) |
626 typedef uint32 Unsigned; | 626 typedef uint32 Unsigned; |
627 #endif | 627 #endif |
628 }; | 628 }; |
629 template<> | 629 template<> |
630 struct ToUnsigned<short> { | 630 struct ToUnsigned<short> { |
631 typedef unsigned short Unsigned; | 631 typedef unsigned short Unsigned; |
632 }; | 632 }; |
633 | 633 |
634 #endif // BASE_STRING_UTIL_H_ | 634 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |