在 std::wstring 中查找方法
我已声明 Wstring
如下
wstring strID
当我尝试按如下所示查找出现的子字符串时,
int index = strID.find("LABS");
我收到如下错误,
error C2664: 'unsigned int std::basic_string<_Elem,_Traits,_Ax>::find(const std::basic_string<_Elem,_Traits,_Ax> &,unsigned int) const' : cannot convert parameter 1 from 'const char [13]' to 'const std::basic_string<_Elem,_Traits,_Ax> &'
您能帮我查找出现的子字符串吗?
I have declared Wstring
as follows
wstring strID
When I try to find the occurrences sub-string as follows
int index = strID.find("LABS");
I am getting error like the following
error C2664: 'unsigned int std::basic_string<_Elem,_Traits,_Ax>::find(const std::basic_string<_Elem,_Traits,_Ax> &,unsigned int) const' : cannot convert parameter 1 from 'const char [13]' to 'const std::basic_string<_Elem,_Traits,_Ax> &'
Can you please help me to find the occurrences of sub-string?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
搜索 wstring 时,您还需要将参数设置为宽字符串
When searching a wstring, you need to have the parameter as a wide string as well
编辑:
http://msdn.microsoft.com/en-我们/library/69ze775t(v=vs.80).aspx
EDIT:
http://msdn.microsoft.com/en-us/library/69ze775t(v=vs.80).aspx