怎么在 string字符串中查找一个特定的字符串

如何在 string字符串中查找一个特定的字符串
例如:查找   maxlength=100> <script> document.f.wd.focus();g() </script> <input   type=hidden   name=cl   value=3>     <input   type=submit   value=百度一下   class=sb> <br> <br> </form> </td> <td   width=100> <a
中的 <br> ,并返回 <br> 的位置

------解决方案--------------------
用find成员函数呀。
你还是装个msdn查查string吧。
------解决方案--------------------
string s;
s = "abdsaletgtfdlkgh343ojgsldfjk0o3 ";
SIZE_T n = s.find( "sale ");

ASSERT(n == 3)
------解决方案--------------------
while(true)
{
pos = s.find( " <br/> ",pos);
if(string::npos == pos)
break;
pos++;
}
------解决方案--------------------
用 find()可以, STL的string提供七种参数形式的find(),如果你可以确定你要查找的字符串靠后或者同时有多个子字符串符合,应该使用rfind()系列或者find_last_of()系列函数来查找,STL的string提供了100个以上的操作函数,,,闲话少说,,给你五个find()函数原型及简单说明:
(1)size_type string::find(char c) const;
(2)size_type string::find(char c,size_type idx) const;
(3)size_type string::find(const string& str) const;
(4)size_type string::find(const string& str,size_type idx) const;
(5)size_type string::find(const char* cstr) const;
(6)size_type string::find(const char* cstr,size_type idx) const;
(7)size_type string::find(const char* cstr,size_type idx,size_type chars_len) const;
说明:
1> .以上函数如果查找失败返回string::npos,如果成功:
函数(1)返回从头开始的第一个字符所在位置
函数(2)返回从idx开始的第一个字符所在位置
函数(3)返回从头开始的第一个子字符串所在位置
函数(4)返回从idx开始的第一个子字符串所在位置
函数(5)返回从头开始的与char*串相等的第一个子串所在位置
函数(6)返回从idx开始的与char*串相等的第一个子串所在位置
函数(7)返回从idx开始的与char*串前chars_len个字符相等的第一个子串所在位置
lz的问题可以采用好多方案:比如

std::string strSrc( "maxlength=100> <script> document.f.wd.focus();g() </script> <input type=hidden name=cl value=3> <input type=submit value=百度一下 class=sb> <br/> <br/> </form> </td> <td width=100> <a
");
std::string::size_type idx = strSrc.find( " <br/> ");
if( std::string::npos != idx )
{
//查找成功,加入处理步骤
}
else
{
//没有找到时的处理
}