【发布时间】:2012-10-05 20:18:48
【问题描述】:
例如:
istringstream ss("hello hi here haha");
string p;
while (iss >> p)
{
if (p == "hello")
statement1;
else if (p == hi)
statement2;
}
这里使用了解析,那么 b 在 c 中可以使用什么来做到这一点?
【问题讨论】:
-
如果我理解正确,
strok。 -
@chris 你能把示例代码放到example..吗?
-
如果你忽略了几个小的 C++ 元素,here's one。
-
其实叫
strtok。我认为@chris 只是打错了字。 Google 应该为您提供大量示例和文档。 -
@Code-Guru,谢谢,我没注意到。