OLD | NEW |
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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 str->resize(length_with_null - 1); | 489 str->resize(length_with_null - 1); |
490 return &((*str)[0]); | 490 return &((*str)[0]); |
491 } | 491 } |
492 | 492 |
493 //----------------------------------------------------------------------------- | 493 //----------------------------------------------------------------------------- |
494 | 494 |
495 // Splits a string into its fields delimited by any of the characters in | 495 // Splits a string into its fields delimited by any of the characters in |
496 // |delimiters|. Each field is added to the |tokens| vector. Returns the | 496 // |delimiters|. Each field is added to the |tokens| vector. Returns the |
497 // number of tokens found. | 497 // number of tokens found. |
498 // | 498 // |
499 // DEPRECATED. Use SplitStringUsingSet for new code (these just forward). | 499 // DEPRECATED. Use base::SplitString for new code (these just forward). |
500 // TODO(brettw) convert callers and delete these forwarders. | 500 // TODO(brettw) convert callers and delete these forwarders. |
501 BASE_EXPORT size_t Tokenize(const base::string16& str, | 501 BASE_EXPORT size_t Tokenize(const base::string16& str, |
502 const base::string16& delimiters, | 502 const base::string16& delimiters, |
503 std::vector<base::string16>* tokens); | 503 std::vector<base::string16>* tokens); |
504 BASE_EXPORT size_t Tokenize(const std::string& str, | 504 BASE_EXPORT size_t Tokenize(const std::string& str, |
505 const std::string& delimiters, | 505 const std::string& delimiters, |
506 std::vector<std::string>* tokens); | 506 std::vector<std::string>* tokens); |
507 BASE_EXPORT size_t Tokenize(const base::StringPiece& str, | 507 BASE_EXPORT size_t Tokenize(const base::StringPiece& str, |
508 const base::StringPiece& delimiters, | 508 const base::StringPiece& delimiters, |
509 std::vector<base::StringPiece>* tokens); | 509 std::vector<base::StringPiece>* tokens); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // string can contain wildcards like * and ? | 546 // string can contain wildcards like * and ? |
547 // The backslash character (\) is an escape character for * and ? | 547 // The backslash character (\) is an escape character for * and ? |
548 // We limit the patterns to having a max of 16 * or ? characters. | 548 // We limit the patterns to having a max of 16 * or ? characters. |
549 // ? matches 0 or 1 character, while * matches 0 or more characters. | 549 // ? matches 0 or 1 character, while * matches 0 or more characters. |
550 BASE_EXPORT bool MatchPattern(const base::StringPiece& string, | 550 BASE_EXPORT bool MatchPattern(const base::StringPiece& string, |
551 const base::StringPiece& pattern); | 551 const base::StringPiece& pattern); |
552 BASE_EXPORT bool MatchPattern(const base::string16& string, | 552 BASE_EXPORT bool MatchPattern(const base::string16& string, |
553 const base::string16& pattern); | 553 const base::string16& pattern); |
554 | 554 |
555 #endif // BASE_STRINGS_STRING_UTIL_H_ | 555 #endif // BASE_STRINGS_STRING_UTIL_H_ |
OLD | NEW |