src/StringFix.cpp
/**
   * Extract blocks separated with @param complete_match_start and @param complete_match_end from the @param content
   * @return vector of blocks, including the start and end match keys
   */
Extract blocks separated with @param complete_match_start and @param complete_match_end from the @param content
@return vector of blocks, including the start and end match keys
Extract blocks separated with @param complete_match_start and @param complete_match_end from the @param content @return vector of blocks including the start and end match keys
std::vector<std::string> extract(const std::string& complete_match_start, const std::string& complete_match_end,
                                    const std::string& content) {
      if (complete_match_start.size() == 0 or complete_match_end.size() == 0) {
         return {};
      }
      std::vector<std::string> result;
      const std::string::size_type startKeySize = complete_match_start.size();
      const std::string::size_type stopKeySize = complete_match_end.size();
      std::string::size_type found = 0;
      auto ContinueSearch = [](std::string::size_type found) { return found != std::string::npos;};
      while (ContinueSearch(found)) {
         auto found_start = content.find(complete_match_start, found);
         if (!ContinueSearch(found_start)) {
            break;
         }
         auto found_stop = content.find(complete_match_end, found_start + startKeySize);
         if (!ContinueSearch(found_stop)) {
            break;
         }
         found = found_stop + stopKeySize;
         auto size = found - found_start;
         result.push_back(content.substr(found_start, size));
         if (found >= content.size()) {
            break;
         }
      }
      return result;
   }
std :: vector < std :: string > extract ( const std :: string & complete_match_start , const std :: string & complete_match_end , const std :: string & content ) { if ( complete_match_start . size ( ) == 0 or complete_match_end . size ( ) == 0 ) { return { } ; } std :: vector < std :: string > result ; const std :: string :: size_type startKeySize = complete_match_start . size ( ) ; const std :: string :: size_type stopKeySize = complete_match_end . size ( ) ; std :: string :: size_type found = 0 ; auto ContinueSearch = [ ] ( std :: string :: size_type found ) { return found != std :: string :: npos ; } ; while ( ContinueSearch ( found ) ) { auto found_start = content . find ( complete_match_start , found ) ; if ( ! ContinueSearch ( found_start ) ) { break ; } auto found_stop = content . find ( complete_match_end , found_start + startKeySize ) ; if ( ! ContinueSearch ( found_stop ) ) { break ; } found = found_stop + stopKeySize ; auto size = found - found_start ; result . push_back ( content . substr ( found_start , size ) ) ; if ( found >= content . size ( ) ) { break ; } } return result ; }
Extract blocks separated with @param complete_match_start and @param complete_match_end from the @param content
 @return vector of blocks, including the start and end match keys
Extract blocks separated with @param complete_match_start and @param complete_match_end from the @param content @return vector of blocks including the start and end match keys