Documentation for OpenFLUID 2.2.0
StringHelpers.hpp File Reference

Detailed Description

#include <string>
#include <list>
#include <sstream>
#include <vector>
#include <openfluid/base/FrameworkException.hpp>
#include <openfluid/dllexport.hpp>
Include dependency graph for StringHelpers.hpp:

Go to the source code of this file.

Namespaces

 openfluid
 
 openfluid::tools
 

Functions

std::string OPENFLUID_API openfluid::tools::toLowerCase (const std::string &Str)
 
std::string OPENFLUID_API openfluid::tools::toUpperCase (const std::string &Str)
 
std::string OPENFLUID_API openfluid::tools::trimLeft (const std::string &Str)
 
std::string OPENFLUID_API openfluid::tools::trimRight (const std::string &Str)
 
std::string OPENFLUID_API openfluid::tools::trim (const std::string &Str)
 
template<typename T >
bool openfluid::tools::toNumeric (const std::string &Str, T &Num)
 
template<typename T >
openfluid::tools::toNumeric (const std::string &Str)
 
bool OPENFLUID_API openfluid::tools::toBoolean (const std::string &Str)
 
bool OPENFLUID_API openfluid::tools::startsWith (const std::string &Str, const std::string &SubStr)
 
bool OPENFLUID_API openfluid::tools::endsWith (const std::string &Str, const std::string &SubStr)
 
bool OPENFLUID_API openfluid::tools::contains (const std::string &Str, const std::string &SubStr, bool CaseSensitive=true)
 
std::string OPENFLUID_API openfluid::tools::replace (const std::string &Str, const std::string &SearchStr, const std::string &ReplaceStr)
 
template<class... A>
std::string openfluid::tools::format (const std::string &Fmt, A &&...Args)
 
std::vector< std::string > OPENFLUID_API openfluid::tools::split (const std::string &Str, const char Sep, bool KeepEmpty=false)
 
std::vector< std::string > OPENFLUID_API openfluid::tools::split (const std::string &Str, const std::string &SepChars, bool KeepEmpty=false)
 
std::string OPENFLUID_API openfluid::tools::join (const std::vector< std::string > &Vect, const std::string &Sep)
 
std::vector< std::string > &OPENFLUID_API operator<< (std::vector< std::string > &Vect, std::string &&Str)
 
std::vector< std::string > &OPENFLUID_API operator<< (std::vector< std::string > &Vect, const std::string &Str)
 
std::vector< std::string > &OPENFLUID_API operator<< (std::vector< std::string > &Vect, const std::vector< std::string > &OtherVect)
 

Function Documentation

◆ operator<<() [1/3]

std::vector<std::string>& OPENFLUID_API operator<< ( std::vector< std::string > &  Vect,
const std::string &  Str 
)

Stream operator to append a string to a vector of strings

std::vector<std::string> VectStr;
std::string Word = "strings";
VectStr << "Add" << Word << "to";
// VectStr = ["Add","strings","to"]
VectStr << "vectors";
// VectStr = ["Add","strings","to","vectors"]

◆ operator<<() [2/3]

std::vector<std::string>& OPENFLUID_API operator<< ( std::vector< std::string > &  Vect,
const std::vector< std::string > &  OtherVect 
)

Stream operator to append a vector of string to another vector of strings

std::vector<std::string> VectStr = {"My","favourite","color"};
std::vector<std::string> OtherVectStr = {"is","green"};
VectStr << OtherVectStr;
// VectStr = ["My","favourite","color","is","green"]

◆ operator<<() [3/3]

std::vector<std::string>& OPENFLUID_API operator<< ( std::vector< std::string > &  Vect,
std::string &&  Str 
)

Stream operator to append a plain text to a vector of strings

std::vector<std::string> VectStr;
std::string Word = "strings";
VectStr << "Add" << Word << "to";
// VectStr = ["Add","strings","to"]
VectStr << "vectors";
// VectStr = ["Add","strings","to","vectors"]