我一直試圖從irr::stringw
(irrlicht遊戲引擎核心字符串)轉換,以便我可以簡單地使用分隔符分隔字符串來創建數組/列表。無法從字符串轉換爲字符串/字符
但是,我無法從stringw轉換,它與任何常規函數都不兼容。
所以,到stringw
分成列表我有以下幾點:
vector<stringw> split(stringw str, char delimiter){
vector<stringw> internal;
std::string tok;
std::string std_s(str.c_str(), str.size());
while (getline(std_s, tok, delimiter)) {
internal.push_back(tok);
}
return internal;
}
但是這裏的錯誤是:str.c_str()
說:No instance of constructor "std::basic::string matches argument list. Argument types are (const wchar_t*, irr:u32)
在getline
方法錯誤:No instance of overloaded function "getline" matches the argument list. Argument types are: (std::string, std::string, char).
我已經嘗試了幾個小時的幾種方法來將stringw
分割爲「;」的分隔符。 (分號),但沒有任何工作。有什麼建議?