ecoli_string(3)

πŸ“¦
version 0.11.3 Β· 4 versions
, in epel 9

πŸ’– ecoli_string(3) β€” Libecoli πŸ’–

okay bestie, welcome to ecoli_string, the Libecoli page that's literally all about string manipulation ✨ β€” it's giving "helpers for strings manipulation" and nothing else. no cap, that's the whole vibe. πŸŽ€


🌸 NAME 🌸

ecoli_string β€” string manipulation, bestie.

  • Helpers for strings manipulation. that's it, that's the job πŸ’…

✨ 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. fr fr, that's the entire detailed description. iconic minimalism πŸ‘‘


πŸ‘‘ Function Documentation πŸ‘‘

πŸ’œ size_t ec_strcmp_count (const char * s1, const char * s2)

Counts how many identical characters show up at the very beginning of two strings. literally comparing them character by character until they stop matching, and it tells you the count 🫢


πŸ’œ int ec_str_startswith (const char * s, const char * beginning)

Returns 1 if the string starts with the given prefix. that's the vibe check: does s begin with beginning? yes or no, no drama ⭐


πŸ’œ bool ec_str_is_space (const char * s)

Returns true if the string contains only whitespace characters. so like, all spaces and vibes, nothing else 🌸


πŸ’œ int ec_str_parse_llint (const char * str, unsigned int base, int64_t min, int64_t max, int64_t * val)

Parses a string for a signed integer. yes bestie, we're doing number parsing πŸ”₯

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, returns 0. Otherwise, returns -1 and sets errno. πŸ’€ (so always check errno, iykyk)


πŸ’œ int ec_str_parse_ullint (const char * str, unsigned int base, uint64_t min, uint64_t max, uint64_t * val)

Parses a string for an unsigned integer. same energy as the signed one, just no negativity allowed πŸ¦‹

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, returns 0. Otherwise, returns -1 and sets errno. 😭 same rules, bestie.


πŸ’œ char* ec_str_quote (const char * str, char quote, bool force)

Quotes a string, escaping any nested quotes. very demure, very careful πŸŽ€

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(). 🫢 don't forget, or that's a leak and we don't do leaks ✨


πŸ’œ char* ec_str_wrap (const char * str, size_t max_cols, size_t start_off)

Wraps text to a maximum number of columns. the formatting glow-up πŸ’…

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(). πŸ™ˆ yes, free() it. please.


🧚 Author 🧚

Generated automatically by Doxygen for Libecoli from the source code. not a human, just Doxygen doing its main character thing πŸ€–πŸ’–


lowkey reminder: anything that hands you back an allocated string (ec_str_quote, ec_str_wrap) is yours to free(). no cap, that's not optional. πŸ’€

and that's the page, bestie β€” Version 0.11.3, dated Thu Apr 9 2026, brought to you by Libecoli. slay, go parse some strings πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from