Add utils::count_words and utils::trim_comment
This commit is contained in:
16
src/utils.h
16
src/utils.h
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user