EC_STR_QUOTE(3)

NAME
ec_str_quote - Quote a string, escaping nested quotes.

SYNOPSIS
#include <ecoli/string.h>

char * ec_str_quote(
    const char   *str,    /* The string to quote. */
    /*
     * The quote character to use: usually " or ' but can be anything. If 0,

     * select between " or ' automatically.
     */
    char          quote,
    /*
     * If true, always add quotes, else add them only if the string contains
     * spaces or quotes.
     */
    bool          force
);

RETURN VALUE

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

SEE ALSO

ec_str_parse_llint(3), ec_str_startswith(3), ec_str_is_space(3), ec_strcmp_count(3), ec_str_parse_ullint(3), ec_str_wrap(3)

COPYRIGHT

Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.