当前位置: 首页>>代码示例>>C++>>正文


C++ string::find方法代码示例

本文整理汇总了C++中flux::string::find方法的典型用法代码示例。如果您正苦于以下问题:C++ string::find方法的具体用法?C++ string::find怎么用?C++ string::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flux::string的用法示例。


在下文中一共展示了string::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: t

XMLFile::Tag::Tag(const Flux::string n, Flux::string conts)
{
  Name = n;
  Content = conts;
  for (unsigned i = 0; i < conts.size(); i++)
  {
    char c = conts.at(i);
    if (c == '<' && conts.at(i+1) != '/' && conts.at(i+1) != ' ')
    {
      bool SelfContained = false;
      std::string tag = "";
      std::string contents = "";
      for (unsigned j = 1;conts.at(i+j) != '>' && conts.at(i+j) != ' '; j++)
      {
	tag += conts.at(i+j);
      }
      for (unsigned o = 1; conts.at(i+o) != '>'; o++)
      {
	if ((conts.at(i+o) == '/' || conts.at(i+o) == '?') && conts.at(i+o+1) == '>')
	{
	  SelfContained = true;
	  break;
	}
      }
      if (!SelfContained)
      {
	for (unsigned k = conts.find('>',i)+1; k < conts.find("</"+tag,i); k++)
	{
	  contents += conts.at(k);
	}
      }
      Tag t(tag,contents);
      for (unsigned l = 1; conts.at(i+l) != '>'; l++)
      {
	char cc = conts.at(i+l);
	if (cc == '=' && conts.at(i+l+1) == '"')
	{
	  std::string attribName = "";
	  std::string attribVal = "";
	  for (int m = -1; conts.at(i+l+m) != ' '; m--)
	  {
	    attribName.insert(0,1,conts.at(i+l+m));
	  }
	  for (unsigned nn = 2; conts.at(i+l+nn) != '"'; nn++)
	  {
	    attribVal += conts.at(i+l+nn);
	  }
	  Tag::Attribute att(attribVal);
	  t.Attributes[attribName] = att;
	}
      }
      Tags[tag] = t;
      i += contents.size();
    }
  }
}
开发者ID:DeathBlade,项目名称:Navn,代码行数:56,代码来源:xmlfile.cpp

示例2:

/** Construct the object, sets everything to 0
 */
sockaddrs::sockaddrs(const Flux::string &address)
{
	this->clear();
	if (!address.empty())
		this->pton(address.find(':') != Flux::string::npos ? AF_INET6 : AF_INET, address);
}
开发者ID:Justasic,项目名称:TandemBicycle,代码行数:8,代码来源:Socket.cpp


注:本文中的flux::string::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。