LLBC_String LLBC_ToLower(const char *str) { LLBC_String convertedStr(str); char ch = '\0'; const LLBC_String::size_type length = convertedStr.size(); for (register LLBC_String::size_type i = 0; i < length; i ++) { ch = convertedStr[i]; if (ch >= 'A' && ch <= 'Z') { convertedStr[i] += 32; } } return convertedStr; }
Platform::String^ Utilities::ConvertUTF8ToString(char* str) { int length = MultiByteToWideChar( CP_UTF8, 0, str, -1, nullptr, 0); if (length == 0) throw ref new Platform::FailureException(); std::unique_ptr<wchar_t[]> convertedStr(new wchar_t[length]); length = MultiByteToWideChar( CP_UTF8, 0, str, -1, convertedStr.get(), length); if (length == 0) throw ref new Platform::FailureException(); return ref new Platform::String(convertedStr.get()); }
std::string charVecToStr(std::vector<char> vec) { std::string convertedStr(vec.begin(), vec.end()); return convertedStr; }