Add utils::count_words and utils::trim_comment

This commit is contained in:
Richard Berger
2020-05-15 15:46:38 -04:00
parent 807130c771
commit db46521d64
4 changed files with 58 additions and 0 deletions

View File

@ -126,6 +126,22 @@ namespace LAMMPS_NS {
*/
tagint tnumeric(const char *file, int line, const char *str,
bool do_abort, LAMMPS *lmp);
/**
* \brief Trim anything from '#' onward
* \param line string that should be trimmed
* \return new string without comment (string)
*/
std::string trim_comment(const std::string & line);
/**
* \brief Count words in a single line, trim anything from '#' onward
* \param text string that should be trimmed and searched
* \param seperators string containing characters that will be treated as whitespace
* \return number of words found
*/
size_t count_words(const std::string & text, const std::string & seperators = " \t\r\n\f");
}
}