#include "stdafx.h"
#include<string>
#include<iostream>
using std::string;
using std::cout;
using std::endl;
int _tmain(int argc, _TCHAR* argv[])
{
string strResource = "123456789";
string strFind1 = "15", strFind2="23", strFind3="a2";
string::size_type pos = string::npos;
//搜索strFind1在strResource第一次出现的位置
pos = strResource.find(strFind1);
//搜索从下标=1开始,strFind1在strResource第一次出现的位置
pos = strResource.find(strFind1,1);
//搜索strFind2最后一次在strResource中出现的位置
pos = strResource.rfind(strFind2);
//搜索从下标=1开始,strFind2最后一次在strResource中出现的位置
pos = strResource.rfind(strFind2, 1);
//搜索strFind3或strFind3中部分字符串在strResource中第一次出现的位置
pos = strResource.find_first_of(strFind3);
//搜索从下标=1开始,strFind3或strFind3中部分字符串在strResource中第一次出现的位置
pos = strResource.find_first_of(strFind3,1);
//搜索strFind3或strFind3中部分字符串在strResource中最后一次出现的位置
pos = strResource.find_last_of(strFind3);
//搜索从下标=1开始,strFind3或strFind3中部分字符串在strResource中最后一次出现的位置
pos = strResource.find_last_of(strFind3,1);
//搜索第一个不存在于strFind3的字符的位置
pos = strResource.find_first_not_of(strFind3);
//搜索从下标=1开始,第一个不存在于strFind3的字符的位置
pos = strResource.find_first_not_of(strFind3,1);
//搜索到下标=strResource.length()结束,最后一个不存在于strFind3的字符的位置
pos = strResource.find_last_not_of(strFind3,strResource.length());
//搜索到下标=2结束,最后一个不存在于strFind3的字符的位置
pos = strResource.find_last_not_of(strFind3,2);
return 0;
}