ecoli_string - Man Page

Name

ecoli_string — String manipulation

— Helpers for strings manipulation.  

Synopsis

Functions

size_t ec_strcmp_count (const char *s1, const char *s2)
int ec_str_startswith (const char *s, const char *beginning)
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)
char * ec_str_quote (const char *str, char quote, bool force)
char * ec_str_wrap (const char *str, size_t max_cols, size_t start_off)

Detailed Description

Helpers for strings manipulation.

Function Documentation

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'

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.

Parameters

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.

Returns

On success, return 0. Else, return -1 and set errno.

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.

Parameters

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.

Returns

On success, return 0. Else, return -1 and set errno.

char * ec_str_quote (const char * str, char quote, bool force)

Quote a string, escaping nested quotes.

Parameters

str The string to quote.
quote The quote character to use: usually " or ' but can be anything. If 0,  select between " or ' automatically.
force If true, always add quotes, else add them only if the string contains spaces or quotes.

Returns

An allocated string, that must be freed by the caller using free().

char * ec_str_wrap (const char * str, size_t max_cols, size_t start_off)

Wrap a text to a maximum number of columns.

Parameters

str The input text.
max_cols The maximum number of columns.
start_off The number of already consumed columns on the first line, filled with padding in other lines.

Returns

An allocated string containing the wrapped text. It must be freed by the user using free().

Author

Generated automatically by Doxygen for Libecoli from the source code.

Referenced By

The man pages ec_strcmp_count(3), ec_str_is_space(3), ec_str_parse_llint(3), ec_str_parse_ullint(3), ec_str_quote(3), ec_str_startswith(3) and ec_str_wrap(3) are aliases of ecoli_string(3).

Version 0.10.1 Libecoli