120inline int wildcmp(
const std::string& wild,
const std::string& str,
bool case_s);
144template<
typename... Args>
159char*
gcvt(T value,
int ndigits,
char* buf,
size_t len);
186char*
itoa(T value,
char* buffer,
int base = 10);
197std::string
itostr(T value,
int base = 10);
207T
toFloat(
const char* ptr,
char** end_ptr =
nullptr);
215template<
typename T,
typename S = std::
string>
225template<
typename T,
typename S = std::
string>
282int fcvt_r(T value,
int ndigit,
int* decpt,
int* sign,
char* buf,
size_t len);
305int ecvt_r(T value,
int ndigit,
int* decpt,
int* sign,
char* buf,
size_t len);
309#include <misc/gen/string.hpp>
#define _MISC_FUNC
Definition misc/global.h:39
Definition Application.h:10
_MISC_FUNC std::string bitToString(unsigned long wrd, size_t count)
Converts an integer value to bit string '0' and '1' characters where the first character is the first...
std::string string_format(const std::string &format, Args &&... args)
Better implementation of 'stringf' ?
_MISC_FUNC std::string escape(const std::string &str, char delimiter='\0')
Escapes all control and non ascii characters.
_MISC_FUNC std::string hexString(const void *buffer, size_t sz)
Converts a block of data to a hexadecimal string.
_MISC_FUNC std::string trimRight(std::string s, const std::string &t=" ")
Trims a passed string right and returns it.
_MISC_FUNC size_t strnspn(const char *s, size_t n, const char *accept)
The strncspn() function calculates the length of the initial segment of 's' which consists entirely o...
_MISC_FUNC std::istream & read_to_delimiter(std::istream &is, std::string &s, char delimiter)
Read a stream until a given delimiter.
_MISC_FUNC std::string demangle(const char *name)
Returns the unmangled function name returned by type ID.
_MISC_FUNC std::string numberString(double value, int digits, bool sign_on=true)
String formats a floating point or integer value using scientific notation. where the exponent is alw...
std::string toStringPrecision(T value, int prec=std::numeric_limits< int >::max())
Converts any floating point value in to a string with a given precision. The default precision shows ...
_MISC_FUNC const char * strnstr(const char *s, const char *find, size_t n)
Find the first occurrence of find in s, where the search is limited to the first slen characters of s...
T toFloat(const char *ptr, char **end_ptr=nullptr)
A locale independent template version for std::strtof(), std::strtod() and std::strtold() functions w...
T toNumberDefault(const S &s, T def)
Converts a std::string to a T value and when not possible it returns the passed default.
_MISC_FUNC std::string stringf(const char *fmt,...)
Creates a formatted string and returns it in a string class instance.
_MISC_FUNC std::string trim(std::string s, const std::string &t=" ")
Trims a passed string at both sides and returns it.
int fcvt_r(T value, int ndigit, int *decpt, int *sign, char *buf, size_t len)
Function identical to ecvt(), except that 'ndigits' specifies the number of digits after the decimal ...
_MISC_FUNC char * decimal_separator_fix(char *buffer, size_t len)
Replaces a decimal comma for a point. This instead of changing the global locale. Used by template fu...
_MISC_FUNC char hexCharValue(char ch)
Returns numeric the value of the passed hexadecimal character.
_MISC_FUNC size_t strncspn(const char *s, size_t n, const char *reject)
The strncspn() function calculates the length of the initial segment of 's' which consists entirely o...
_MISC_FUNC std::string error_string(int error_num)
Thread safe version strerror_r() or strerror_s() when cross compiling for Windows.
std::string itostr(T value, int base=10)
Converts an integer type value to a std::string.
_MISC_FUNC std::string toUpper(std::string s)
Converts the passed string into an upper case one and returns it.
_MISC_FUNC std::string unescape(const std::string &str)
Unescapes the passed string escaped by the escape() function.
_MISC_FUNC int digits(double value)
Returns the amount of digits which are significant for the value. When the value is 12300....
_MISC_FUNC std::string trimLeft(std::string s, const std::string &t=" ")
Trims a passed string left and returns it.
_MISC_FUNC std::string toLower(std::string s)
Converts the passed string into a lower case one and returns it.
std::string gcvtString(T value, int ndigits=0)
Converts a floating-point number to a string always using a decimal point.
T toNumber(const S &s, size_t *idx=nullptr)
Converts a std::string to a T value and whe not possible it returns the passed default.
char * gcvt(T value, int ndigits, char *buf, size_t len)
Converts a floating-point number to a string always using a decimal point. It produces 'digits' signi...
_MISC_FUNC int wildcmp(const char *wild, const char *str, bool case_s)
Matches a string against a wildcard string such as "*.*" or "bl?h.*" etc.
int ecvt_r(T value, int ndigit, int *decpt, int *sign, char *buf, size_t len)
Converts number to a null-terminated string of 'ndigits' digits. where 'ndigits' is reduced to a syst...
_MISC_FUNC std::string filter(std::string str, const std::string &filter)
Filters all characters from the passed string and returns the resulting string.
std::string toString(T value, int digits=0)
The function converts number to a minimal length. It produces 'digits' significant digits in either p...
_MISC_FUNC size_t stringHex(const char *hexstr, void *buffer, size_t sz)
Converts a hexadecimal string to a block of data.
_MISC_FUNC std::string replaceAll(const std::string &s, const std::string &from, const std::string &to)
Replaces all occurrences of 'from' substring and replaces them with 'to' string.
char * itoa(T value, char *buffer, int base=10)
Converts an integer type value to a buffer. The itoa function converts value to a null-terminated buf...