| 469 | |
| 470 | |
| 471 | std::wstring string2wstring(const std::string& str) { |
| 472 | if (str.empty()) { |
| 473 | return {}; |
| 474 | } |
| 475 | |
| 476 | int size_needed = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), static_cast<int>(str.size()), nullptr, 0); |
| 477 | std::wstring result(size_needed, 0); |
| 478 | MultiByteToWideChar(CP_UTF8, 0, str.c_str(), static_cast<int>(str.size()), &result[0], size_needed); |
| 479 | return result; |
| 480 | } |
| 481 | |
| 482 | |
| 483 | bool wstring_starts_with(const std::wstring& str, const std::wstring& prefix) { |