diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-13 16:14:42 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-13 16:14:42 +0000 |
commit | 1d5980af2fbdc5820784d7eb01755940838d0e10 (patch) | |
tree | 8300c67d0e6edb9789bb9a7552239f7a0c675e3d /base | |
parent | 1947868ed7d749fb6ee2895ce9e9e5af9d11a085 (diff) | |
download | chromium_src-1d5980af2fbdc5820784d7eb01755940838d0e10.zip chromium_src-1d5980af2fbdc5820784d7eb01755940838d0e10.tar.gz chromium_src-1d5980af2fbdc5820784d7eb01755940838d0e10.tar.bz2 |
Move TrimWhitespaceUTF8 from string_util_icu to string_util.
It does not directly use ICU, so this is its proper home.
Review URL: http://codereview.chromium.org/155415
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/string_util.cc | 14 | ||||
-rw-r--r-- | base/string_util_icu.cc | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/base/string_util.cc b/base/string_util.cc index 2699f26..dcc6c30 100644 --- a/base/string_util.cc +++ b/base/string_util.cc @@ -1656,3 +1656,17 @@ std::string HexEncode(const void* bytes, size_t size) { } return ret; } + +TrimPositions TrimWhitespaceUTF8(const std::string& input, + TrimPositions positions, + std::string* output) { + // This implementation is not so fast since it converts the text encoding + // twice. Please feel free to file a bug if this function hurts the + // performance of Chrome. + DCHECK(IsStringUTF8(input)); + std::wstring input_wide = UTF8ToWide(input); + std::wstring output_wide; + TrimPositions result = TrimWhitespace(input_wide, positions, &output_wide); + *output = WideToUTF8(output_wide); + return result; +} diff --git a/base/string_util_icu.cc b/base/string_util_icu.cc index 3bd6f9b..f8a2d99 100644 --- a/base/string_util_icu.cc +++ b/base/string_util_icu.cc @@ -674,17 +674,3 @@ std::wstring FormatNumber(int64 number) { return std::wstring(buffer, static_cast<std::wstring::size_type>(length)); #endif // defined(WCHAR_T_IS_UTF32) } - -TrimPositions TrimWhitespaceUTF8(const std::string& input, - TrimPositions positions, - std::string* output) { - // This implementation is not so fast since it converts the text encoding - // twice. Please feel free to file a bug if this function hurts the - // performance of Chrome. - DCHECK(IsStringUTF8(input)); - std::wstring input_wide = UTF8ToWide(input); - std::wstring output_wide; - TrimPositions result = TrimWhitespace(input_wide, positions, &output_wide); - *output = WideToUTF8(output_wide); - return result; -} |