X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Futility%2Fstringutil.h;fp=src%2Fgromacs%2Futility%2Fstringutil.h;h=034f258013a60872ddfd2701481aaeff25d4534f;hb=c3f2d46e4047f0c465f7234b3784a2fa6f02a065;hp=004daae3e0353708bfa75d731a5fe6fd2db4b0db;hpb=0595b4a4c763a0bc574658992081abf8b0abc3fe;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/utility/stringutil.h b/src/gromacs/utility/stringutil.h index 004daae3e0..034f258013 100644 --- a/src/gromacs/utility/stringutil.h +++ b/src/gromacs/utility/stringutil.h @@ -101,6 +101,27 @@ static inline bool endsWith(const std::string &str, const char *suffix) return endsWith(str.c_str(), suffix); } +/*!\brief Returns number of space-separated words in zero-terminated char ptr + * + * \param s Character pointer to zero-terminated, which will not be changed. + * + * \returns number of words in string. + * + * \note This routine is mainly meant to support legacy code in GROMACS. For + * new source you should try hard to use C++ string objects instead. + */ +std::size_t +countWords(const char *s); + +/*!\brief Returns the number of space-separated words in a string object + * + * \param str Reference to string object, which will not be changed. + * + * \returns number of words in string. + */ +std::size_t +countWords(const std::string &str); + /*! \brief * Removes a suffix from a string. *