Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.

Function template find_match

boost::date_time::find_match — Find index of a string in either of 2 arrays.


// In header: <boost/date_time/date_parsing.hpp>

template<typename charT> 
  short find_match(const charT *const * short_names, 
                   const charT *const * long_names, short size, 
                   const std::basic_string< charT > & s);


find_match searches both arrays for a match to 's'. Both arrays must contain 'size' elements. The index of the match is returned. If no match is found, 'size' is returned. Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2. 'size' can be sent in with: (greg_month::max)() (which 12), (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues