我有以下字符串:如何從一串字符串中獲取字符串?
"hw_core_detectionhook::Iocard const*"
我得到的只有第一部分,即所有文字空間之前存在的,即我只需要"hw_core_detectionhook::Iocard"
一部分。
我有以下字符串:如何從一串字符串中獲取字符串?
"hw_core_detectionhook::Iocard const*"
我得到的只有第一部分,即所有文字空間之前存在的,即我只需要"hw_core_detectionhook::Iocard"
一部分。
std::stringstream ss;
ss << "hw_core_detectionhook::Iocard const*";
std::string s;
ss >> s;
std::cout << s;
輸出:
hw_core_detectionhook::Iocard
參閱完整的在線演示:http://www.ideone.com/w9l1C
我不知道stringstream會這樣做。謝謝。 +1 – karlphillip 2011-04-19 13:02:16
它是一個'的std :: string'或'字符*'? – kennytm 2011-04-19 12:59:03
http://stackoverflow.com/questions/236129/how-to-split-a-string – reggie 2011-04-19 13:00:59