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 <string> | 10 #include <string> |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 bool ElideString(const std::wstring& input, int max_len, std::wstring* output); | 521 bool ElideString(const std::wstring& input, int max_len, std::wstring* output); |
522 | 522 |
523 // Returns true if the string passed in matches the pattern. The pattern | 523 // Returns true if the string passed in matches the pattern. The pattern |
524 // string can contain wildcards like * and ? | 524 // string can contain wildcards like * and ? |
525 // TODO(iyengar) This function may not work correctly for CJK strings as | 525 // TODO(iyengar) This function may not work correctly for CJK strings as |
526 // it does individual character matches. | 526 // it does individual character matches. |
527 // The backslash character (\) is an escape character for * and ? | 527 // The backslash character (\) is an escape character for * and ? |
528 bool MatchPattern(const std::wstring& string, const std::wstring& pattern); | 528 bool MatchPattern(const std::wstring& string, const std::wstring& pattern); |
529 bool MatchPattern(const std::string& string, const std::string& pattern); | 529 bool MatchPattern(const std::string& string, const std::string& pattern); |
530 | 530 |
| 531 // Returns a hex string representation of a binary buffer. |
| 532 // The returned hex string will be in upper case. |
| 533 // This function does not check if |size| is within reasonable limits since |
| 534 // it's written with trusted data in mind. |
| 535 // If you suspect that the data you want to format might be large, |
| 536 // the absolute max size for |size| should be is |
| 537 // std::numeric_limits<size_t>::max() / 2 |
| 538 std::string HexEncode(const void* bytes, size_t size); |
| 539 |
531 #endif // BASE_STRING_UTIL_H_ | 540 #endif // BASE_STRING_UTIL_H_ |
532 | |
OLD | NEW |