在 std::wstring 中查找方法
Find method in 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> &'
你能帮我找到子字符串的出现吗?
搜索 wstring 时,还需要将参数作为宽字符串
int index = strID.find(L"LABS");
^
int index = strID.find(L"LABS");
编辑:http://msdn.microsoft.com/en-US/library/69ze775t(v=vs.80(.aspx
相关文章:
- 有没有一种方法可以创建一个带有哈希表的数据库,该哈希表具有恒定时间查找功能
- 在C++中查找像素 RGB 数据的最快方法是什么?
- 查找定义我的 C/C++ 函数/宏的文件比'grep'更简单的方法
- 在向量中查找大于 0(或通常为 k)的最小元素的最佳方法是什么?
- 在目录中查找所有.cpp.h文件(include,src等)的传统方法
- Visual Studio 2015资源视图和资源编译器使用不同的方法在项目目录中查找图标文件.如何修复
- CMAKE:查找/添加Visual Studio或Windows SDK库和标头的正确方法?
- 我最近正在阅读opencv源代码。有没有更好的方法来在opencv库中查找类定义?
- 查找字符串是否包含字符串向量的任何一个元素的最佳方法
- 查找和替换子阵列的最佳方法
- 在矢量中查找映射键的最快方法
- 按名称查找进程 ID 的快速方法
- 需要帮助从12个字节生成新的24字节RGB查找阵列,或者是一种更好的编码方法
- 字符串查找方法找不到第一字母
- 按值在地图中查找 - 方法在速度方面的偏好
- 在std ::查找方法中的类对象的比较
- 是否有 std 或提升容器可以避免其插入和查找方法之间的争用条件
- 查找方法以查找较大字符串中的子字符串
- 在 std::wstring 中查找方法
- C++:查找方法