當前位置: 首頁>>代碼示例>>C++>>正文


C++ string_t::back方法代碼示例

本文整理匯總了C++中string_t::back方法的典型用法代碼示例。如果您正苦於以下問題:C++ string_t::back方法的具體用法?C++ string_t::back怎麽用?C++ string_t::back使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在string_t的用法示例。


在下文中一共展示了string_t::back方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: IsResolution

    bool Parser::IsResolution(const string_t& str)
    {
        // Using a regex such as "\\d{3,4}(p|(x\\d{3,4}))$" would be more elegant,
        // but it's much slower (e.g. 2.4ms -> 24.9ms).

        // *###x###*
        if (str.size() >= 3 + 1 + 3)
        {
            size_t pos = str.find_first_of(L"xX\u00D7");  // multiplication sign
            if (pos != str.npos)
            {
                for (size_t i = 0; i < str.size(); i++)
                    if (i != pos && !IsNumericChar(str.at(i)))
                        return false;
                return true;
            }

            // *###p
        }
        else if (str.size() >= 3 + 1)
        {
            if (str.back() == L'p' || str.back() == L'P')
            {
                for (size_t i = 0; i < str.size() - 1; i++)
                    if (!IsNumericChar(str.at(i)))
                        return false;
                return true;
            }
        }

        return false;
    }
開發者ID:Soinou,項目名稱:MeliMelo,代碼行數:32,代碼來源:parser_helper.cpp

示例2: MatchJapaneseCounterPattern

bool Parser::MatchJapaneseCounterPattern(const string_t& word, Token& token) {
  if (word.back() != L'\u8A71')
    return false;

  static const regex_t pattern(L"(\\d{1,3})\u8A71");
  regex_match_results_t match_results;

  if (std::regex_match(word, match_results, pattern)) {
    SetEpisodeNumber(match_results[1].str(), token, false);
    return true;
  }

  return false;
}
開發者ID:KasaiDot,項目名稱:anitomy,代碼行數:14,代碼來源:parser_number.cpp

示例3: GetFolderForFile

  string_t cImportProcess::GetFolderForFile(const string_t& sFromFilePath, const string_t& sToFolder) const
  {
    ostringstream_t o;

    o<<sToFolder;
    if (sToFolder.back() != spitfire::filesystem::cFilePathSeparator) o<<spitfire::filesystem::sFilePathSeparator;
    const spitfire::util::cDateTime dateTime = spitfire::filesystem::GetLastModifiedDate(sFromFilePath);
    if (bSeparateFolderForEachYear) o<<dateTime.GetYear()<<spitfire::filesystem::sFilePathSeparator;

    if (bDescription && !sDescriptionText.empty()) {
      if (bSeparateFolderForEachDate) o<<dateTime.GetDateYYYYMMDD()<<" ";

      o<<sDescriptionText<<spitfire::filesystem::sFilePathSeparator;
    } else if (bSeparateFolderForEachDate) o<<dateTime.GetDateYYYYMMDD()<<spitfire::filesystem::sFilePathSeparator;

    return o.str();
  }
開發者ID:pilkch,項目名稱:diesel,代碼行數:17,代碼來源:importthread.cpp

示例4: MatchEpisodePatterns

bool Parser::MatchEpisodePatterns(string_t word, Token& token) {
  // All patterns contain at least one non-numeric character
  if (IsNumericString(word))
    return false;

  TrimString(word, L" -");

  const bool numeric_front = IsNumericChar(word.front());
  const bool numeric_back = IsNumericChar(word.back());

  // e.g. "01v2"
  if (numeric_front && numeric_back)
    if (MatchSingleEpisodePattern(word, token))
      return true;
  // e.g. "01-02", "03-05v2"
  if (numeric_front && numeric_back)
    if (MatchMultiEpisodePattern(word, token))
      return true;
  // e.g. "2x01", "S01E03", "S01-02xE001-150"
  if (numeric_back)
    if (MatchSeasonAndEpisodePattern(word, token))
      return true;
  // e.g. "ED1", "OP4a", "OVA2"
  if (!numeric_front)
    if (MatchTypeAndEpisodePattern(word, token))
      return true;
  // e.g. "07.5"
  if (numeric_front && numeric_back)
    if (MatchFractionalEpisodePattern(word, token))
      return true;
  // e.g. "4a", "111C"
  if (numeric_front && !numeric_back)
    if (MatchPartialEpisodePattern(word, token))
      return true;
  // e.g. "#01", "#02-03v2"
  if (numeric_back)
    if (MatchNumberSignPattern(word, token))
      return true;
  // U+8A71 is used as counter for stories, episodes of TV series, etc.
  if (numeric_front)
    if (MatchJapaneseCounterPattern(word, token))
      return true;

  return false;
}
開發者ID:KasaiDot,項目名稱:anitomy,代碼行數:45,代碼來源:parser_number.cpp


注:本文中的string_t::back方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。