diff options
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; -} |