aboutsummaryrefslogtreecommitdiff
path: root/src/common/String.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/String.cpp')
-rw-r--r--src/common/String.cpp10
1 files changed, 10 insertions, 0 deletions
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 <cstring>
+#include <string_view>
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 <typename C>
@@ -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