使用 std:: string 要#include<string>
1 构造函数
std::string tmp_str((char*)dSipAOR); 字符串dSipAOR为参数构造string tmp_str
2 查找函数
tmp_str.find('@',0); //从tmp_str第0个字符开始查找,出现字符@的位置 //返回值从0开始
如果找不到,返回std::string::npos。 他是这样定义的:static const size_type npos = -1;
3 获取字串
user_name = tmp_str.substr(0,loc); 获取从0开始的loc个字符组成新的字符串
4 字符串清空
domain_name.erase();