diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 01:44:17 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 01:44:17 +0000 |
commit | 0443f912a956df7b52edf997d05d0108be995fef (patch) | |
tree | 7701f14445c681dee145058d7090c21b2863b011 /base/string_util.h | |
parent | a2fbebee62a76a9f6f75ea3231028454623c53e6 (diff) | |
download | chromium_src-0443f912a956df7b52edf997d05d0108be995fef.zip chromium_src-0443f912a956df7b52edf997d05d0108be995fef.tar.gz chromium_src-0443f912a956df7b52edf997d05d0108be995fef.tar.bz2 |
Implement RemoveChars, a function to remove a list of characters from a string, and use it in PhoneNumber to remove extra phone number characters.
BUG=none
TEST=StringUtilTest.RemoveChars
Review URL: http://codereview.chromium.org/572015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r-- | base/string_util.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/base/string_util.h b/base/string_util.h index 34f9386..60f4f25 100644 --- a/base/string_util.h +++ b/base/string_util.h @@ -143,6 +143,19 @@ extern const char kWhitespaceASCII[]; extern const char kUtf8ByteOrderMark[]; +// Removes characters in remove_chars from anywhere in input. Returns true if +// any characters were removed. +// NOTE: Safe to use the same variable for both input and output. +bool RemoveChars(const std::wstring& input, + const wchar_t remove_chars[], + std::wstring* output); +bool RemoveChars(const string16& input, + const char16 remove_chars[], + string16* output); +bool RemoveChars(const std::string& input, + const char remove_chars[], + std::string* output); + // Removes characters in trim_chars from the beginning and end of input. // NOTE: Safe to use the same variable for both input and output. bool TrimString(const std::wstring& input, |