diff options
Diffstat (limited to 'base/i18n/rtl.cc')
-rw-r--r-- | base/i18n/rtl.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc index 4755a94..9fbf35e 100644 --- a/base/i18n/rtl.cc +++ b/base/i18n/rtl.cc @@ -225,6 +225,21 @@ std::wstring GetDisplayStringInLTRDirectionality(std::wstring* text) { return *text; } +const string16 StripWrappingBidiControlCharacters(const string16& text) { + if (text.empty()) + return text; + size_t begin_index = 0; + char16 begin = text[begin_index]; + if (begin == kLeftToRightEmbeddingMark || + begin == kRightToLeftEmbeddingMark || + begin == kLeftToRightOverride || + begin == kRightToLeftOverride) + ++begin_index; + size_t end_index = text.length() - 1; + if (text[end_index] == kPopDirectionalFormatting) + --end_index; + return text.substr(begin_index, end_index - begin_index + 1); +} + } // namespace i18n } // namespace base - |