CoolProp  6.6.0
An open-source fluid property and humid air property database
Macros | Functions
CPstrings.h File Reference
#include <iterator>
#include <algorithm>
#include <functional>
#include <cctype>
#include <vector>
#include "fmt/format.h"
#include "fmt/printf.h"
#include "Exceptions.h"

Go to the source code of this file.

Macros

#define FMT_HEADER_ONLY
 

Functions

void StringToWString (const std::string &s, std::wstring &ws)
 
std::string & strlstrip (std::string &s)
 The following code for the trim functions was taken from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring. More...
 
std::string & strrstrip (std::string &s)
 
std::string & strstrip (std::string &s)
 
bool endswith (const std::string &s1, const std::string &s2)
 Simple string function to check for end of string being equal to given string. More...
 
std::string format (const char *format, fmt::ArgList args)
 
std::vector< std::string > strsplit (const std::string &s, char del)
 
std::string upper (std::string str)
 
std::string lower (std::string str)
 
std::string strjoin (const std::vector< std::string > &strings, const std::string &delim)
 
bool strstartswith (const std::string &s, const std::string &other)
 A convenience function that return true if a string begins with the given other string. More...
 
double string2double (const std::string &s)
 Convert a number encoded as a string to a double. More...
 

Macro Definition Documentation

◆ FMT_HEADER_ONLY

#define FMT_HEADER_ONLY

Definition at line 13 of file CPstrings.h.

Function Documentation

◆ endswith()

bool endswith ( const std::string &  s1,
const std::string &  s2 
)
inline

Simple string function to check for end of string being equal to given string.

Definition at line 65 of file CPstrings.h.

◆ format()

std::string format ( const char *  format,
fmt::ArgList  args 
)
inline

Definition at line 84 of file CPstrings.h.

◆ lower()

std::string lower ( std::string  str)
inline

Definition at line 98 of file CPstrings.h.

◆ string2double()

double string2double ( const std::string &  s)
inline

Convert a number encoded as a string to a double.

Parameters
sThe string to be converted
Note

Definition at line 116 of file CPstrings.h.

◆ StringToWString()

void StringToWString ( const std::string &  s,
std::wstring &  ws 
)
inline

Copy string to wstring Dangerous if the string has non-ASCII characters; from http://stackoverflow.com/a/8969776/1360263

Definition at line 28 of file CPstrings.h.

◆ strjoin()

std::string strjoin ( const std::vector< std::string > &  strings,
const std::string &  delim 
)

Definition at line 7 of file CPstrings.cpp.

◆ strlstrip()

std::string& strlstrip ( std::string &  s)
inline

The following code for the trim functions was taken from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring.

Definition at line 42 of file CPstrings.h.

◆ strrstrip()

std::string& strrstrip ( std::string &  s)
inline

Definition at line 55 of file CPstrings.h.

◆ strsplit()

std::vector<std::string> strsplit ( const std::string &  s,
char  del 
)

Definition at line 20 of file CPstrings.cpp.

◆ strstartswith()

bool strstartswith ( const std::string &  s,
const std::string &  other 
)
inline

A convenience function that return true if a string begins with the given other string.

Definition at line 106 of file CPstrings.h.

◆ strstrip()

std::string& strstrip ( std::string &  s)
inline

Definition at line 61 of file CPstrings.h.

◆ upper()

std::string upper ( std::string  str)
inline

Definition at line 93 of file CPstrings.h.