Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Reference

Header <boost/algorithm/string.hpp>
Header <boost/algorithm/string/case_conv.hpp>
Header <boost/algorithm/string/classification.hpp>
Header <boost/algorithm/string/compare.hpp>
Header <boost/algorithm/string/concept.hpp>
Header <boost/algorithm/string/constants.hpp>
Header <boost/algorithm/string/erase.hpp>
Header <boost/algorithm/string/find.hpp>
Header <boost/algorithm/string/find_format.hpp>
Header <boost/algorithm/string/find_iterator.hpp>
Header <boost/algorithm/string/finder.hpp>
Header <boost/algorithm/string/formatter.hpp>
Header <boost/algorithm/string/iter_find.hpp>
Header <boost/algorithm/string/join.hpp>
Header <boost/algorithm/string/predicate.hpp>
Header <boost/algorithm/string/regex.hpp>
Header <boost/algorithm/string/regex_find_format.hpp>
Header <boost/algorithm/string/replace.hpp>
Header <boost/algorithm/string/sequence_traits.hpp>
Header <boost/algorithm/string/split.hpp>
Header <boost/algorithm/string/std_containers_traits.hpp>
Header <boost/algorithm/string/trim.hpp>
Header <boost/algorithm/string/trim_all.hpp>
Header <boost/algorithm/string_regex.hpp>

Cumulative include for string_algo library

Defines sequence case-conversion algorithms. Algorithms convert each element in the input sequence to the desired case using provided locales.


  
    template<typename OutputIteratorT, typename RangeT> 
       
      (, ,  = );
    template<typename SequenceT> 
       (,  = );
    template<typename WritableRangeT> 
       (,  = );
    template<typename OutputIteratorT, typename RangeT> 
       
      (, ,  = );
    template<typename SequenceT> 
       (,  = );
    template<typename WritableRangeT> 
       (,  = );
  }
}

Classification predicates are included in the library to give some more convenience when using algorithms like trim() and all(). They wrap functionality of STL classification functions ( e.g. std::isspace() ) into generic functors.


  
     (,  = );
     ( = );
     ( = );
     ( = );
     ( = );
     ( = );
     ( = );
     ( = );
     ( = );
     ( = );
     ( = );
     ( = );
    template<typename RangeT>  ();
    template<typename CharT>  (, );
    template<typename Pred1T, typename Pred2T> 
       (, 
                             );
    template<typename Pred1T, typename Pred2T> 
       (, 
                             );
    template<typename PredT> 
       ();
  }
}

Defines element comparison predicates. Many algorithms in this library can take an additional argument with a predicate used to compare elements. This makes it possible, for instance, to have case insensitive versions of the algorithms.


  
    struct is_equal;
    struct is_iequal;
    struct is_iless;
    struct is_less;
    struct is_not_greater;
    struct is_not_igreater;
  }
}

Defines concepts used in string_algo library


  
    template<typename FinderT, typename IteratorT> struct FinderConcept;
    template<typename FormatterT, typename FinderT, typename IteratorT> 
      struct FormatterConcept;
  }
}

  
    enum token_compress_mode_type;
  }
}

Defines various erase algorithms. Each algorithm removes part(s) of the input according to a searching criteria.


  
    template<typename OutputIteratorT, typename RangeT> 
       
      (, , 
                       );
    template<typename SequenceT> 
       (, 
                                 );
    template<typename SequenceT> 
       (, 
                       );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , );
    template<typename SequenceT, typename RangeT> 
       (, );
    template<typename SequenceT, typename RangeT> 
       (, );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , , 
                         = );
    template<typename SequenceT, typename RangeT> 
       (, , 
                                   = );
    template<typename SequenceT, typename RangeT> 
       (, ,  = );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , );
    template<typename SequenceT, typename RangeT> 
       (, );
    template<typename SequenceT, typename RangeT> 
       (, );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , , 
                        = );
    template<typename SequenceT, typename RangeT> 
       (, , 
                                  = );
    template<typename SequenceT, typename RangeT> 
       (, ,  = );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , , );
    template<typename SequenceT, typename RangeT> 
       (, , );
    template<typename SequenceT, typename RangeT> 
       (, , );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , , , 
                       = );
    template<typename SequenceT, typename RangeT> 
       (, , , 
                                 = );
    template<typename SequenceT, typename RangeT> 
       (, , , 
                       = );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , );
    template<typename SequenceT, typename RangeT> 
       (, );
    template<typename SequenceT, typename RangeT> 
       (, );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , , 
                       = );
    template<typename SequenceT, typename RangeT> 
       (, , 
                                 = );
    template<typename SequenceT, typename RangeT> 
       (, ,  = );
    template<typename OutputIteratorT, typename RangeT> 
       (, , );
    template<typename SequenceT> 
       (, );
    template<typename SequenceT>  (, );
    template<typename OutputIteratorT, typename RangeT> 
       (, , );
    template<typename SequenceT> 
       (, );
    template<typename SequenceT>  (, );
  }
}

Defines a set of find algorithms. The algorithms are searching for a substring of the input. The result is given as an iterator_range delimiting the substring.


  
    template<typename RangeT, typename FinderT> 
       
      (, );
    template<typename Range1T, typename Range2T> 
       
      (, );
    template<typename Range1T, typename Range2T> 
       
      (, ,  = );
    template<typename Range1T, typename Range2T> 
       
      (, );
    template<typename Range1T, typename Range2T> 
       
      (, ,  = );
    template<typename Range1T, typename Range2T> 
       
      (, , );
    template<typename Range1T, typename Range2T> 
       
      (, , ,  = );
    template<typename RangeT> 
       
      (, );
    template<typename RangeT> 
       
      (, );
    template<typename RangeT, typename PredicateT> 
       
      (, ,  = );
  }
}

Defines generic replace algorithms. Each algorithm replaces part(s) of the input. The part to be replaced is looked up using a Finder object. Result of finding is then used by a Formatter object to generate the replacement.


  
    template<typename OutputIteratorT, typename RangeT, typename FinderT, 
             typename FormatterT> 
       
      (, , , );
    template<typename SequenceT, typename FinderT, typename FormatterT> 
       (, , );
    template<typename SequenceT, typename FinderT, typename FormatterT> 
       (, , );
    template<typename OutputIteratorT, typename RangeT, typename FinderT, 
             typename FormatterT> 
       
      (, , , 
                           );
    template<typename SequenceT, typename FinderT, typename FormatterT> 
       (, , );
    template<typename SequenceT, typename FinderT, typename FormatterT> 
       (, , );
  }
}

Defines find iterator classes. Find iterator repeatedly applies a Finder to the specified input string to search for matches. Dereferencing the iterator yields the current match or a range between the last and the current match depending on the iterator used.


  
    template<typename IteratorT> class find_iterator;
    template<typename IteratorT> class split_iterator;
    template<typename RangeT, typename FinderT> 
      find_iterator<  
      (, );
    template<typename RangeT, typename FinderT> 
      split_iterator<  
      (, );
  }
}

Defines Finder generators. Finder object is a functor which is able to find a substring matching a specific criteria in the input. Finders are used as a pluggable components for replace, find and split facilities. This header contains generator functions for finders provided in this library.


  
    template<typename RangeT>  ();
    template<typename RangeT, typename PredicateT> 
       (, );
    template<typename RangeT>  ();
    template<typename RangeT, typename PredicateT> 
       (, );
    template<typename RangeT>  (, );
    template<typename RangeT, typename PredicateT> 
       (, , );
     ();
     ();
    template<typename PredicateT> 
       (,  = );
    template<typename ForwardIteratorT> 
       (, );
    template<typename ForwardIteratorT> 
       ();
  }
}

Defines Formatter generators. Formatter is a functor which formats a string according to given parameters. A Formatter works in conjunction with a Finder. A Finder can provide additional information for a specific Formatter. An example of such a cooperation is regex_finder and regex_formatter.

Formatters are used as pluggable components for replace facilities. This header contains generator functions for the Formatters provided in this library.


  
    template<typename RangeT>  ();
    template<typename RangeT>  ();
    template<typename RangeT>  ();
    template<typename FinderT>  ();
  }
}

Defines generic split algorithms. Split algorithms can be used to divide a sequence into several part according to a given criteria. Result is given as a 'container of containers' where elements are copies or references to extracted parts.

There are two algorithms provided. One iterates over matching substrings, the other one over the gaps between these matches.


  
    template<typename SequenceSequenceT, typename RangeT, typename FinderT> 
       (, , );
    template<typename SequenceSequenceT, typename RangeT, typename FinderT> 
       (, , );
  }
}

Defines join algorithm.

Join algorithm is a counterpart to split algorithms. It joins strings from a 'list' by adding user defined separator. Additionally there is a version that allows simple filtering by providing a predicate.


  
    template<typename SequenceSequenceT, typename Range1T> 
       
      (, );
    template<typename SequenceSequenceT, typename Range1T, 
             typename PredicateT> 
       
      (, , );
  }
}

Defines string-related predicates. The predicates determine whether a substring is contained in the input string under various conditions: a string starts with the substring, ends with the substring, simply contains the substring or if both strings are equal. Additionaly the algorithm all() checks all elements of a container to satisfy a condition.

All predicates provide the strong exception guarantee.


  
    template<typename Range1T, typename Range2T, typename PredicateT> 
       (, , );
    template<typename Range1T, typename Range2T> 
       (, );
    template<typename Range1T, typename Range2T> 
       (, , 
                         = );
    template<typename Range1T, typename Range2T, typename PredicateT> 
       (, , );
    template<typename Range1T, typename Range2T> 
       (, );
    template<typename Range1T, typename Range2T> 
       (, , 
                       = );
    template<typename Range1T, typename Range2T, typename PredicateT> 
       (, , );
    template<typename Range1T, typename Range2T> 
       (, );
    template<typename Range1T, typename Range2T> 
       (, ,  = );
    template<typename Range1T, typename Range2T, typename PredicateT> 
       (, , );
    template<typename Range1T, typename Range2T> 
       (, );
    template<typename Range1T, typename Range2T> 
       (, ,  = );
    template<typename Range1T, typename Range2T, typename PredicateT> 
       (, , 
                                   );
    template<typename Range1T, typename Range2T> 
       (, );
    template<typename Range1T, typename Range2T> 
       (, , 
                                     = );
    template<typename RangeT, typename PredicateT> 
       (, );
  }
}

Defines regex variants of the algorithms.


  
    template<typename RangeT, typename CharT, typename RegexTraitsT> 
       
      (, , 
                  = );
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
       
      (, , 
                         , 
                         , 
                          = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
       (, 
                                   , 
                                   , 
                                    = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
       (, 
                         , 
                         , 
                          = );
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT, typename FormatStringTraitsT, 
             typename FormatStringAllocatorT> 
       
      (, , 
                             , 
                             , 
                              = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
       (, 
                                       , 
                                       , 
                                        = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT, 
             typename FormatStringTraitsT, typename FormatStringAllocatorT> 
       (, 
                             , 
                             , 
                              = );
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
       
      (, , 
                       , 
                        = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
       (, 
                                 , 
                                  = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
       (, 
                       , 
                        = );
    template<typename OutputIteratorT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
       
      (, , 
                           , 
                            = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
       (, 
                                     , 
                                      = );
    template<typename SequenceT, typename CharT, typename RegexTraitsT> 
       (, 
                           , 
                            = );
    template<typename SequenceSequenceT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
       
      (, , 
                     , 
                      = );
    template<typename SequenceSequenceT, typename RangeT, typename CharT, 
             typename RegexTraitsT> 
       
      (, , 
                  , 
                   = );
    template<typename SequenceSequenceT, typename Range1T, typename CharT, 
             typename RegexTraitsT> 
       
      (, , 
              ,  = );
  }
}

Defines the regex_finder and regex_formatter generators. These two functors are designed to work together. regex_formatter uses additional information about a match contained in the regex_finder search result.


  
    template<typename CharT, typename RegexTraitsT> 
       (, 
                                = );
    template<typename CharT, typename TraitsT, typename AllocT> 
       (, 
                                   = );
  }
}

Defines various replace algorithms. Each algorithm replaces part(s) of the input according to set of searching and replace criteria.


  
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , 
                         , 
                         );
    template<typename SequenceT, typename RangeT> 
       (, 
                                   , 
                                   );
    template<typename SequenceT, typename RangeT> 
       (, 
                         , 
                         );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , 
                         );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , 
                                   );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , 
                          ,  = );
    template<typename SequenceT, typename Range2T, typename Range1T> 
       (, , 
                                    ,  = );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , , 
                           = );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , 
                        );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , 
                                  );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , 
                         ,  = );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , 
                                   ,  = );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , , 
                          = );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , , 
                       );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , , 
                                 );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , , );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , 
                        , ,  = );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , , 
                                  ,  = );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , , , 
                         = );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , 
                       );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , 
                                 );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , );
    template<typename OutputIteratorT, typename Range1T, typename Range2T, 
             typename Range3T> 
       
      (, , , 
                        ,  = );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , 
                                  ,  = );
    template<typename SequenceT, typename Range1T, typename Range2T> 
       (, , , 
                         = );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , , 
                        );
    template<typename SequenceT, typename RangeT> 
       (, , );
    template<typename SequenceT, typename RangeT> 
       (, , );
    template<typename OutputIteratorT, typename Range1T, typename Range2T> 
       
      (, , , 
                        );
    template<typename SequenceT, typename RangeT> 
       (, , );
    template<typename SequenceT, typename RangeT> 
       (, , );
  }
}

Traits defined in this header are used by various algorithms to achieve better performance for specific containers. Traits provide fail-safe defaults. If a container supports some of these features, it is possible to specialize the specific trait for this container. For lacking compilers, it is possible of define an override for a specific tester function.

Due to a language restriction, it is not currently possible to define specializations for stl containers without including the corresponding header. To decrease the overhead needed by this inclusion, user can selectively include a specialization header for a specific container. They are located in boost/algorithm/string/stl directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp header which contains specializations for all stl containers.


  
    template<typename T> class has_const_time_erase;
    template<typename T> class has_const_time_insert;
    template<typename T> class has_native_replace;
    template<typename T> class has_stable_iterators;
  }
}

Defines basic split algorithms. Split algorithms can be used to divide a string into several parts according to given criteria.

Each part is copied and added as a new element to the output container. Thus the result container must be able to hold copies of the matches (in a compatible structure like std::string) or a reference to it (e.g. using the iterator range class). Examples of such a container are std::vector<std::string> or std::list<boost::iterator_range<std::string::iterator>>


  
    template<typename SequenceSequenceT, typename Range1T, typename Range2T> 
       
      (, , );
    template<typename SequenceSequenceT, typename Range1T, typename Range2T> 
       
      (, , , 
                 = );
    template<typename SequenceSequenceT, typename RangeT, typename PredicateT> 
       
      (, , , 
             = );
  }
}

This file includes sequence traits for stl containers.

Defines trim algorithms. Trim algorithms are used to remove trailing and leading spaces from a sequence (string). Space is recognized using given locales.

Parametric (_if) variants use a predicate (functor) to select which characters are to be trimmed.. Functions take a selection predicate as a parameter, which is used to determine whether a character is a space. Common predicates are provided in classification.hpp header.


  
    template<typename OutputIteratorT, typename RangeT, typename PredicateT> 
       
      (, , );
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT> 
       (,  = );
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT> 
       (,  = );
    template<typename OutputIteratorT, typename RangeT, typename PredicateT> 
       
      (, , );
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT> 
       (,  = );
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT> 
       (,  = );
    template<typename OutputIteratorT, typename RangeT, typename PredicateT> 
       
      (, , );
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT> 
       (,  = );
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT> 
       (,  = );
  }
}

Defines trim_all algorithms.

Just like trim, trim_all removes all trailing and leading spaces from a sequence (string). In addition, spaces in the middle of the sequence are truncated to just one character. Space is recognized using given locales.

trim_fill acts as trim_all, but the spaces in the middle are replaces with a user-define sequence of character.

Parametric (_if) variants use a predicate (functor) to select which characters are to be trimmed.. Functions take a selection predicate as a parameter, which is used to determine whether a character is a space. Common predicates are provided in classification.hpp header.


  
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT, typename PredicateT> 
       (, );
    template<typename SequenceT> 
       (,  = );
    template<typename SequenceT> 
       (,  = );
    template<typename SequenceT, typename RangeT, typename PredicateT> 
       (, , 
                                  );
    template<typename SequenceT, typename RangeT, typename PredicateT> 
       (, , );
    template<typename SequenceT, typename RangeT> 
       (, , 
                                = );
    template<typename SequenceT, typename RangeT> 
       (, ,  = );
  }
}

Cumulative include for string_algo library. In addition to string.hpp contains also regex-related stuff.


PrevUpHomeNext