Ember

String stuffs

Jul 29th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. // String functions
  2.  
  3. // UTF-8 string to UTF-16 string
  4. inline WString widen(const String &str)
  5. {
  6.     return std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(str);
  7. }
  8.  
  9. // UTF-16 string to UTF-8 string
  10. inline String narrow(const WString &wstr)
  11. {
  12.     return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(wstr);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment