Added toAscii overload
This commit is contained in:
parent
2cce8eebd9
commit
e415d59c16
|
@ -108,6 +108,15 @@ string toAscii(const u32string& s) {
|
|||
return result;
|
||||
}
|
||||
|
||||
string toAscii(const wstring& s) {
|
||||
string result;
|
||||
for (wchar_t ch : s) {
|
||||
optional<char> ascii = toAscii(ch);
|
||||
if (ascii) result.append(1, *ascii);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
u32string utf8ToUtf32(const string& s) {
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1900
|
||||
// Workaround for Visual Studio 2015
|
||||
|
|
|
@ -16,6 +16,8 @@ boost::optional<char> toAscii(char32_t ch);
|
|||
|
||||
std::string toAscii(const std::u32string& s);
|
||||
|
||||
std::string toAscii(const std::wstring& s);
|
||||
|
||||
std::u32string utf8ToUtf32(const std::string& s);
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Reference in New Issue