我只需要将 1 char
转换为 string
。相反的方法很简单,比如 str[0]
。
以下对我不起作用:
char c = 34;
string(1,c);
//this doesn't work, the string is always empty.
string s(c);
//also doesn't work.
boost::lexical_cast<string>((int)c);
//also doesn't work.
原文由 weeo 发布,翻译遵循 CC BY-SA 4.0 许可协议
所有的
和
和
为我工作。