molecular
|
Utility functions for string processing. More...
Functions | |
int | ScanF (const char *string, const char *format,...) |
Wrapper for sscanf that ignores the current locale. More... | |
bool | EndsWith (const char *haystack, const char *needle) |
Returns true if haystack ends with needle. More... | |
bool | EndsWith (const std::string &haystack, const std::string &needle) |
Returns true if haystack ends with needle. More... | |
std::string | StrError (int errnum) |
Wrapper around strerror_s or strerror. More... | |
template<class T > | |
std::vector< std::string > | ExplodeImpl (const std::string &str, T delimiter) |
std::vector< std::string > | Explode (const std::string &str, char delimiter) |
Splits a string at the given delimiter and returns list of delimited elements. More... | |
std::vector< std::string > | Explode (const std::string &str, const char *delimiters) |
Splits a string at the given delimiters and returns list of delimited elements. More... | |
bool | Equals (const char *a, const char *b) |
Returns true if strings are equal. More... | |
template<class TStorage > | |
std::string | FromStorage (TStorage &storage) |
Reads entire storage (e.g. a file) and returns it as string. More... | |
template<size_t size> | |
void | Copy (const char *source, char(&dest)[size]) |
Wrapper around strncpy with automatic destination size determination. More... | |
template<size_t size> | |
void | Copy (const std::string &source, char(&dest)[size]) |
Wrapper around strncpy with automatic destination size determination. More... | |
Utility functions for string processing.
void molecular::util::StringUtils::Copy | ( | const char * | source, |
char(&) | dest[size] | ||
) |
Wrapper around strncpy with automatic destination size determination.
void molecular::util::StringUtils::Copy | ( | const std::string & | source, |
char(&) | dest[size] | ||
) |
Wrapper around strncpy with automatic destination size determination.
bool molecular::util::StringUtils::EndsWith | ( | const char * | haystack, |
const char * | needle | ||
) |
Returns true if haystack ends with needle.
bool molecular::util::StringUtils::EndsWith | ( | const std::string & | haystack, |
const std::string & | needle | ||
) |
Returns true if haystack ends with needle.
|
inline |
Returns true if strings are equal.
std::vector< std::string > molecular::util::StringUtils::Explode | ( | const std::string & | str, |
char | delimiter | ||
) |
Splits a string at the given delimiter and returns list of delimited elements.
std::vector< std::string > molecular::util::StringUtils::Explode | ( | const std::string & | str, |
const char * | delimiters | ||
) |
Splits a string at the given delimiters and returns list of delimited elements.
std::vector<std::string> molecular::util::StringUtils::ExplodeImpl | ( | const std::string & | str, |
T | delimiter | ||
) |
std::string molecular::util::StringUtils::FromStorage | ( | TStorage & | storage | ) |
Reads entire storage (e.g. a file) and returns it as string.
int molecular::util::StringUtils::ScanF | ( | const char * | string, |
const char * | format, | ||
... | |||
) |
Wrapper for sscanf that ignores the current locale.
std::string molecular::util::StringUtils::StrError | ( | int | errnum | ) |
Wrapper around strerror_s or strerror.