From 2e379441f69c4fd3049d186f76b25457e6250282 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 12 Aug 2021 21:44:32 +0800 Subject: ... --- src/common/String.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/common/String.cpp') diff --git a/src/common/String.cpp b/src/common/String.cpp index ce124575..91422d48 100644 --- a/src/common/String.cpp +++ b/src/common/String.cpp @@ -1,8 +1,14 @@ #include "cru/common/String.hpp" +#include "cru/common/StringUtil.hpp" #include +#include namespace cru { +String String::FromUtf8(const char* str, Index size) { + return String{cru::ToUtf16(std::string_view(str, size))}; +} + std::uint16_t String::kEmptyBuffer[1] = {0}; template @@ -138,4 +144,8 @@ String::iterator String::erase(const_iterator start, const_iterator end) { return s; } +std::string String::ToUtf8() const { + return cru::ToUtf8(std::u16string_view(Char16CStr(), size())); +} + } // namespace cru -- cgit v1.2.3