在std :: wstring中查找方法

Pra*_*bhu 3 c++ string wstring

我已声明Wstring如下

wstring strID
Run Code Online (Sandbox Code Playgroud)

当我尝试按如下方式查找出现的子字符串时

int index =   strID.find("LABS");
Run Code Online (Sandbox Code Playgroud)

我收到如下错误

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> &'
Run Code Online (Sandbox Code Playgroud)

你能帮我找一下子串的出现吗?

Bo *_*son 15

搜索wstring时,您还需要将参数作为宽字符串

int index =   strID.find(L"LABS"); 
                         ^
Run Code Online (Sandbox Code Playgroud)