【发布时间】:2012-03-15 02:05:55
【问题描述】:
在 C 中,如何从字符串中提取前 n 个字符,直到在字符串中找到一个空格?本质上,哪个 C 函数会为我找到下一个空格的位置,哪个 C 函数会给我一个子字符串?我正在考虑 C++。如:
string str = "Help me Please!";
int blankPos = str.find(' ');
str.substr(0, blankPos);
谢谢,
【问题讨论】:
标签: c string find substring substr