我一直试图从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
分割为“;”的分隔符。 (分号),但没有任何工作。有什么建议?