Libecoli 0.3.0
Extensible COmmand LIne library
|
Helpers for strings manipulation. More...
Functions | |
size_t | ec_strcmp_count (const char *s1, const char *s2) |
int | ec_str_startswith (const char *s, const char *beginning) |
int | ec_asprintf (char **buf, const char *fmt,...) |
int | ec_vasprintf (char **buf, const char *fmt, va_list ap) |
bool | ec_str_is_space (const char *s) |
int | ec_str_parse_llint (const char *str, unsigned int base, int64_t min, int64_t max, int64_t *val) |
int | ec_str_parse_ullint (const char *str, unsigned int base, uint64_t min, uint64_t max, uint64_t *val) |
Helpers for strings manipulation.
size_t ec_strcmp_count | ( | const char * | s1, |
const char * | s2 ) |
count the number of identical chars at the beginning of 2 strings
int ec_str_startswith | ( | const char * | s, |
const char * | beginning ) |
return 1 if 's' starts with 'beginning'
int ec_asprintf | ( | char ** | buf, |
const char * | fmt, | ||
... ) |
like asprintf, but use libecoli allocator
int ec_vasprintf | ( | char ** | buf, |
const char * | fmt, | ||
va_list | ap ) |
like vasprintf, but use libecoli allocator
bool ec_str_is_space | ( | const char * | s | ) |
return true if string is only composed of spaces (' ', '
', ...)
int ec_str_parse_llint | ( | const char * | str, |
unsigned int | base, | ||
int64_t | min, | ||
int64_t | max, | ||
int64_t * | val ) |
Parse a string for a signed integer.
str | The string to parse. |
base | The base (0 means "guess"). |
min | The minimum allowed value. |
max | The maximum allowed value. |
val | The pointer to the value to be set on success. |
int ec_str_parse_ullint | ( | const char * | str, |
unsigned int | base, | ||
uint64_t | min, | ||
uint64_t | max, | ||
uint64_t * | val ) |
Parse a string for an unsigned integer.
str | The string to parse. |
base | The base (0 means "guess"). |
min | The minimum allowed value. |
max | The maximum allowed value. |
val | The pointer to the value to be set on success. |