Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
stringutil.cpp File Reference
#include "gmxpre.h"
#include "stringutil.h"
#include <cctype>
#include <cstdarg>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
+ Include dependency graph for stringutil.cpp:

Description

Implements functions and classes in stringutil.h.

Author
Teemu Murtola teemu.nosp@m..mur.nosp@m.tola@.nosp@m.gmai.nosp@m.l.com

Functions

std::size_t gmx::countWords (const char *s)
 Returns number of space-separated words in zero-terminated char ptr. More...
 
std::size_t gmx::countWords (const std::string &str)
 Returns the number of space-separated words in a string object. More...
 
bool gmx::endsWith (const char *str, const char *suffix)
 Tests whether a string ends with another string. More...
 
std::string gmx::stripSuffixIfPresent (const std::string &str, const char *suffix)
 Removes a suffix from a string. More...
 
std::string gmx::stripString (const std::string &str)
 Removes leading and trailing whitespace from a string. More...
 
std::string gmx::formatString (const char *fmt,...)
 Formats a string (snprintf() wrapper). More...
 
std::string gmx::formatStringV (const char *fmt, va_list ap)
 Formats a string (vsnprintf() wrapper). More...
 
std::vector< std::string > gmx::splitString (const std::string &str)
 Splits a string to whitespace separated tokens. More...
 
std::vector< std::string > gmx::splitDelimitedString (const std::string &str, char delim)
 Splits a string to tokens separated by a given delimiter. More...
 
std::vector< std::string > gmx::splitAndTrimDelimitedString (const std::string &str, char delim)
 Splits str to tokens separated by delimiter delim. Removes leading and trailing whitespace from those strings with std::isspace. More...
 
bool gmx::anonymous_namespace{stringutil.cpp}::isWordChar (char c)
 Helper function to identify word boundaries for replaceAllWords(). More...
 
std::string gmx::anonymous_namespace{stringutil.cpp}::replaceInternal (const std::string &input, const char *from, const char *to, bool bWholeWords)
 Common implementation for string replacement functions. More...
 
std::string gmx::replaceAll (const std::string &input, const char *from, const char *to)
 Replace all occurrences of a string with another string. More...
 
std::string gmx::replaceAll (const std::string &input, const std::string &from, const std::string &to)
 Replace all occurrences of a string with another string. More...
 
std::string gmx::replaceAllWords (const std::string &input, const char *from, const char *to)
 Replace whole words with others. More...
 
std::string gmx::replaceAllWords (const std::string &input, const std::string &from, const std::string &to)
 Replace whole words with others. More...
 
bool gmx::equalCaseInsensitive (const std::string &source, const std::string &target)
 Return whether two strings are equal, ignoring case. More...
 
bool gmx::equalCaseInsensitive (const std::string &source, const std::string &target, size_t maxLengthOfComparison)
 Checks if at most maxLengthOfComparison characters of two strings match case insensitive. More...