src/StringFix.cpp
/**
    * Explodes a string into sub-strings. Each substring is extracted after a complete
    * match of the "delimeter string"
    *
    * Explode work a litte different from split in that it is very similar to explode in php (and other languages)
    * But it uses a complete string match instead of single character (like split)
    *
    *
    * Scenario:  No match made. String returned as is, without exploding
    * Scenario:  Complete match made. Both strings equal. Complete explode. vector with 1 empty string return
    * Scenario:  string {a::c}, explode on {:}. Return { {"a"},{""},{"c"}}. Please notice the empty string
    *
    * @param complete_match : string matching where to split the content and remove the match
    * @param stringToExplode: to split at the matches
    * @return vector of exploded sub-strings
    */
Explodes a string into sub-strings. Each substring is extracted after a complete
match of the "delimeter string"

Explode work a litte different from split in that it is very similar to explode in php (and other languages)
But it uses a complete string match instead of single character (like split)

No match made. String returned as is, without exploding
Scenario:  Complete match made. Both strings equal. Complete explode. vector with 1 empty string return
Scenario:  string {a::c}, explode on {:}.

@param complete_match : string matching where to split the content and remove the match
@param stringToExplode: to split at the matches
@return vector of exploded sub-strings
Explodes a string into sub - strings . Each substring is extracted after a complete match of the " delimeter string " Explode work a litte different from split in that it is very similar to explode in php ( and other languages ) But it uses a complete string match instead of single character ( like split ) No match made . String returned as is without exploding Scenario : Complete match made . Both strings equal . Complete explode . vector with 1 empty string return Scenario : string { a :: c } explode on { : } . @param complete_match : string matching where to split the content and remove the match @param stringToExplode : to split at the matches @return vector of exploded sub - strings
std::vector<std::string> explode(const std::string& matchAll, const std::string& toExplode) {
      if (matchAll.empty()) {
         return {toExplode};
      }
      std::vector<std::string> foundMatching;
      std::string::size_type position = 0;
      std::string::size_type keySize = matchAll.size();
      std::string::size_type found = 0;
      while ((found != std::string::npos)) {
         found = toExplode.find(matchAll, position);
         std::string item  = toExplode.substr(position, found - position);
         position = found + keySize;
         bool ignore = item.empty() && (std::string::npos == found);
         if (false == ignore) {
            foundMatching.push_back(item);
         }
      }
      return foundMatching;
   }
std :: vector < std :: string > explode ( const std :: string & matchAll , const std :: string & toExplode ) { if ( matchAll . empty ( ) ) { return { toExplode } ; } std :: vector < std :: string > foundMatching ; std :: string :: size_type position = 0 ; std :: string :: size_type keySize = matchAll . size ( ) ; std :: string :: size_type found = 0 ; while ( ( found != std :: string :: npos ) ) { found = toExplode . find ( matchAll , position ) ; std :: string item = toExplode . substr ( position , found - position ) ; position = found + keySize ; bool ignore = item . empty ( ) && ( std :: string :: npos == found ) ; if ( false == ignore ) { foundMatching . push_back ( item ) ; } } return foundMatching ; }
Explodes a string into sub-strings.
Explodes a string into sub - strings .