doxygen
Functions
stringutil.h File Reference

Some helper functions for std::string. More...

#include <string>
#include <string_view>
Include dependency graph for stringutil.h:

Go to the source code of this file.

Functions

void substituteInplace (std::string &s, std::string_view toReplace, std::string_view replaceWith)
 Replaces occurrences of substring toReplace in string s with string replaceWith. More...
 
std::string substituteStringView (std::string_view s, std::string_view toReplace, std::string_view replaceWith)
 Returns a new string where occurrences of substring toReplace in string s are replaced by string replaceWith.
 
std::string_view stripWhiteSpace (std::string_view s)
 Given a string view s, returns a new, narrower view on that string, skipping over any leading or trailing whitespace characters.
 
void addTerminalCharIfMissing (std::string &s, char c)
 
template<size_t N>
bool literal_at (const char *data, const char(&str)[N])
 returns TRUE iff data points to a substring that matches string literal str
 
template<size_t N>
bool literal_at (std::string_view data, const char(&str)[N])
 returns TRUE iff data points to a substring that matches string literal str
 

Detailed Description

Some helper functions for std::string.

Function Documentation

◆ substituteInplace()

void substituteInplace ( std::string &  s,
std::string_view  toReplace,
std::string_view  replaceWith 
)
inline

Replaces occurrences of substring toReplace in string s with string replaceWith.

Modifies s in place.