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


C++ CStdString::find_first_not_of方法代码示例

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


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

示例1: SetFromPeriod

void CDateTimeSpan::SetFromPeriod(const CStdString &period)
{
  long days = atoi(period.c_str());
  // find the first non-space and non-number
  int pos = period.find_first_not_of("0123456789 ", 0);
  if (pos >= 0)
  {
    CStdString units = period.Mid(pos, 3);
    if (units.CompareNoCase("wee") == 0)
      days *= 7;
    else if (units.CompareNoCase("mon") == 0)
      days *= 31;
  }

  SetDateTimeSpan(days, 0, 0, 0);
}
开发者ID:Ayu222,项目名称:android,代码行数:16,代码来源:XBDateTime.cpp

示例2: SetMode

void CGUIDialogNumeric::SetMode(INPUT_MODE mode, const CStdString &initial)
{
  m_mode = mode;
  m_block = 0;
  m_lastblock = 0;
  if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS || m_mode == INPUT_DATE)
  {
    CDateTime dateTime;
    if (m_mode == INPUT_TIME || m_mode == INPUT_TIME_SECONDS)
    {
      // check if we have a pure number
      if (initial.find_first_not_of("0123456789") == std::string::npos)
      {
        long seconds = strtol(initial.c_str(), NULL, 10);
        dateTime = seconds;
      }
      else
      {
        CStdString tmp = initial;
        // if we are handling seconds and if the string only contains
        // "mm:ss" we need to add dummy "hh:" to get "hh:mm:ss"
        if (m_mode == INPUT_TIME_SECONDS && tmp.size() <= 5)
          tmp = "00:" + tmp;
        dateTime.SetFromDBTime(tmp);
      }
    }
    else if (m_mode == INPUT_DATE)
    {
      CStdString tmp = initial;
      StringUtils::Replace(tmp, '/', '.');
      dateTime.SetFromDBDate(tmp);
    }

    if (!dateTime.IsValid())
      return;

    dateTime.GetAsSystemTime(m_datetime);
    m_lastblock = (m_mode == INPUT_DATE) ? 2 : 1;
  }
  else
    SetMode(mode, (void*)&initial);
}
开发者ID:Anankin,项目名称:xbmc,代码行数:42,代码来源:GUIDialogNumeric.cpp

示例3: TrimAll

void TrimAll( CStdString &bs )
{
	try {

		register int iStart, iEnd;

		iStart = bs.find_first_not_of( " \r\n\t\"'", 0 );
		
		if( iStart == bs.npos )
			return;
		
		iEnd = bs.find_last_not_of( " \r\n\t\"'", bs.size()-1 );
		
		if( iEnd == bs.npos )
			return;

		bs = bs.substr( iStart, iEnd - iStart + 1 );
	}
	catch(...){
	}
}
开发者ID:rdmeneze,项目名称:SMSBox-PIC,代码行数:21,代码来源:functions.cpp

示例4: if

CStdString CID3Tag::ParseMP3Genre(const CStdString& str) const
{
  if (!m_dll.IsLoaded())
    m_dll.Load();

  CStdString strTemp = str;
  set<CStdString> setGenres;

  while (!strTemp.IsEmpty())
  {
    // remove any leading spaces
    int i = strTemp.find_first_not_of(" ");
    if (i > 0) strTemp.erase(0, i);

    // pull off the first character
    char p = strTemp[0];

    // start off looking for (something)
    if (p == '(')
    {
      strTemp.erase(0, 1);

      // now look for ((something))
      p = strTemp[0];
      if (p == '(')
      {
        // remove ((something))
        i = strTemp.find_first_of("))");
        strTemp.erase(0, i + 2);
      }
    }

    // no parens, so we have a start of a string
    // push chars into temp string until valid terminator found
    // valid terminators are ) or , or ;
    else
    {
      CStdString t;
      while ((!strTemp.IsEmpty()) && (p != ')') && (p != ',') && (p != ';'))
      {
        strTemp.erase(0, 1);
        t.push_back(p);
        p = strTemp[0];
      }
      // loop exits when terminator is found
      // be sure to remove the terminator
      strTemp.erase(0, 1);

      // remove any leading or trailing white space
      // from temp string
      t.Trim();
      if (!t.size()) continue;

      // if the temp string is natural number try to convert it to a genre string
      if (StringUtils::IsNaturalNumber(t))
      {
        id3_ucs4_t* ucs4=m_dll.id3_latin1_ucs4duplicate((id3_latin1_t*)t.c_str());
        const id3_ucs4_t* genre=m_dll.id3_genre_name(ucs4);
        m_dll.id3_ucs4_free(ucs4);
        t=ToStringCharset(genre, ID3_FIELD_TEXTENCODING_ISO_8859_1);
      }

      // convert RX to Remix as per ID3 V2.3 spec
      else if ((t == "RX") || (t == "Rx") || (t == "rX") || (t == "rx"))
      {
        t = "Remix";
      }

      // convert CR to Cover as per ID3 V2.3 spec
      else if ((t == "CR") || (t == "Cr") || (t == "cR") || (t == "cr"))
      {
        t = "Cover";
      }

      // insert genre name in set
      setGenres.insert(t);
    }

  }

  // return a " / " seperated string
  CStdString strGenre;
  set<CStdString>::iterator it;
  for (it = setGenres.begin(); it != setGenres.end(); it++)
  {
    CStdString strTemp = *it;
    if (!strGenre.IsEmpty())
      strGenre += g_advancedSettings.m_musicItemSeparator;
    strGenre += strTemp;
  }
  return strGenre;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:92,代码来源:Id3Tag.cpp


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