我需要.
在 C++ 中拆分字符串..
下面是我的字符串 -
@event.hello.dc1
现在我需要拆分.
上面的字符串并从中检索@event,然后传递@event
给下面的方法 -
bool upsert(const char* key);
以下是我从这里阅读后得到的代码-
void splitString() {
string sentence = "@event.hello.dc1";
istringstream iss(sentence);
copy(istream_iterator<string>(iss), istream_iterator<string>(), ostream_iterator<string>(cout, "\n"));
}
但我无法理解如何@event
通过使用上述方法拆分来提取,.
因为上述方法仅适用于空格......以及如何通过拆分从该字符串中提取所有内容,.
如下所述 -
split1 = @event
split2 = hello
split3 = dc1
谢谢您的帮助..