ecoli_string(3)

πŸ“¦ version 0.6.0, in fedora 43

πŸ’– ecoli_string πŸ’–

okay so bestie, welcome to ecoli_string from the Library Functions Manual β€” it's the string manipulation page and honestly? it's giving utility queen. everything you need to poke, prod, compare, split and parse strings lives here. let's get into it 🫢


🌸 NAME 🌸

ecoli_string β€” String manipulation

  • Helpers for strings manipulation. (yes that's the whole vibe, she's a helper girlie ✨)

✨ SYNOPSIS ✨

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)

πŸ¦‹ Detailed Description πŸ¦‹

Helpers for strings manipulation. that's it, that's the whole mission statement, and she ate πŸ’…


πŸ‘‘ 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. like how long do these two besties walk in the same direction before they have to part ways 😭


int ec_str_startswith (const char * s, const char * beginning)

return 1 if 's' starts with 'beginning'. simple. iconic. no notes.


int ec_asprintf (char ** buf, const char * fmt, ...)

like asprintf, but use libecoli allocator. same energy, different memory plug πŸ”Œ


int ec_vasprintf (char ** buf, const char * fmt, va_list ap)

like vasprintf, but use libecoli allocator. the va_list sibling of the one above, matching outfits obviously πŸ’œ


bool ec_str_is_space (const char * s)

return true if string is only composed of spaces (' ', '

not me leaving this one exactly as it landed β€” the source text literally cuts off mid-list right there, bestie 😭 the docstring ends after that second quote and we're not about to invent the rest. periodt.

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. no cap, that errno thing matters πŸ‘€


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. same rules, same drama, just unsigned this time πŸ“


🌈 Author 🌈

Generated automatically by Doxygen for Libecoli from the source code. (the robots wrote it, we just made it cute ✨)


πŸ’Œ and that's the whole page, bestie! this one shipped as part of Libecoli, Version 0.6.0 β€” so go forth and manipulate some strings responsibly. mwah πŸŽ€πŸ’–πŸ¦‹ Libecoli β€” Version 0.6.0 🌸
πŸ“¦ where this page comes from