29#include <mstdlib/mstdlib.h>
30#include <mstdlib/base/m_chr.h>
36M_BEGIN_IGNORE_REDECLARATIONS
37#if M_BLACKLIST_FUNC == 1
41 M_DEPRECATED_FOR(
M_str_len,
size_t strlen(
const char *))
46 M_DEPRECATED_FOR(
M_str_cat,
char *strcat(
char *,
const char *))
51 M_DEPRECATED_FOR(
M_str_cpy,
char *strcpy(
char *,
const char *))
56 M_DEPRECATED_FOR(
M_str_cat,
char *strncat(
char *,
const char *,
size_t))
61 M_DEPRECATED_FOR(
M_str_cat,
size_t strlcat(
char *,
const char *,
size_t))
66 M_DEPRECATED_FOR(
M_str_cpy,
char *strncpy(
char *,
const char *,
size_t))
71 M_DEPRECATED_FOR(
M_str_cpy,
size_t strlcpy(
char *,
const char *,
size_t))
77 M_DEPRECATED_FOR(
M_str_eq,
int strcmp(
const char *,
const char *))
83 M_DEPRECATED_FOR(
M_str_eq_max,
int strncmp(
const char *,
const char *,
size_t))
89 M_DEPRECATED_FOR(
M_str_caseeq,
int strcasecmp(
const char *,
const char *))
95 M_DEPRECATED_FOR(
M_str_caseeq_max,
int strncasecmp(
const char *,
const char *,
size_t))
111M_END_IGNORE_REDECLARATIONS
181M_API
size_t M_str_len(
const char *s) M_WARN_UNUSED_RESULT;
470M_API
int M_str_cmpsort(
const char *s1,
const char *s2) M_WARN_UNUSED_RESULT;
558M_API M_bool
M_str_eq(
const char *s1,
const char *s2);
758M_API
char *
M_strdup(
const char *s) M_WARN_UNUSED_RESULT M_MALLOC;
837M_API
char *
M_strdup_unquote(
const char *s,
unsigned char quote,
unsigned char escape) M_WARN_UNUSED_RESULT M_MALLOC;
854M_API
char *
M_strdup_max(
const char *s,
size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC;
874M_API
char *
M_strdup_upper_max(const
char *s,
size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC;
891M_API
char *
M_strdup_lower_max(const
char *s,
size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC;
911M_API
char *
M_strdup_title_max(const
char *s,
size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC;
931M_API
char *
M_strdup_trim_max(const
char *s,
size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC;
951M_API
char *
M_strdup_unquote_max(const
char *s,
unsigned char quote,
unsigned char escape,
size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC;
1204M_API
char *
M_str_remove_quoted(const
char *src,
char quote_char,
char escape_char) M_WARN_UNUSED_RESULT M_MALLOC;
1220M_API
char *
M_str_keep_quoted(const
char *src,
char quote_char,
char escape_char) M_WARN_UNUSED_RESULT M_MALLOC;
1254M_API
char *
M_str_quote(const
char *s,
unsigned char quote,
unsigned char escape) M_WARN_UNUSED_RESULT M_MALLOC;
1266M_API
char *
M_str_quote_max(const
char *s,
unsigned char quote,
unsigned char escape,
size_t max) M_WARN_UNUSED_RESULT M_MALLOC;
1369M_API M_bool
M_str_cpy(
char *dest,
size_t dest_len, const
char *src);
1383M_API M_bool
M_str_cpy_max(
char *dest,
size_t dest_len, const
char *src,
size_t src_len);
1394M_API M_bool
M_str_cat(
char *dest,
size_t dest_len, const
char *src);
1421M_API
char *
M_str_chr(const
char *s,
char c) M_WARN_UNUSED_RESULT;
1433M_API
char *
M_str_rchr(const
char *s,
char c) M_WARN_UNUSED_RESULT;
1476M_API
char *
M_str_str(const
char *haystack, const
char *needle) M_WARN_UNUSED_RESULT;
1486M_API
char *
M_str_casestr(const
char *haystack, const
char *needle) M_WARN_UNUSED_RESULT;
1546M_API
char **
M_str_explode(
unsigned char delim, const
char *s,
size_t s_len,
size_t *num,
size_t **len_array) M_WARN_UNUSED_RESULT M_MALLOC;
1575M_API
char **
M_str_explode_quoted(
unsigned char delim, const
char *s,
size_t s_len,
unsigned char quote_char,
unsigned char escape_char,
size_t max_sects,
size_t *num,
size_t **len_array) M_WARN_UNUSED_RESULT M_MALLOC;
1592M_API
char **
M_str_explode_str(
unsigned char delim, const
char *s,
size_t *num) M_WARN_UNUSED_RESULT M_MALLOC;
1616 M_bool truncate,
size_t *num) M_WARN_UNUSED_RESULT M_MALLOC;
1640M_API
char **
M_str_explode_str_quoted(
unsigned char delim, const
char *s,
unsigned char quote_char,
unsigned char escape_char,
size_t max_sects,
size_t *num) M_WARN_UNUSED_RESULT M_MALLOC;
1660M_API
int *
M_str_explode_int(
unsigned char delim, const
char *s,
size_t *num) M_WARN_UNUSED_RESULT M_MALLOC;
1688M_API
char *
M_str_implode(
unsigned char delim,
unsigned char enclose_char,
unsigned char escape_char,
char **strs,
size_t num_strs, M_bool always_enclose) M_WARN_UNUSED_RESULT M_MALLOC;
1703M_API
char *
M_str_implode_int(
unsigned char delim, const
int *ints,
size_t num_ints) M_WARN_UNUSED_RESULT M_MALLOC;
1750M_API M_int64
M_atofi_prec(
const char *s,
int impliedDecimals) M_WARN_UNUSED_RESULT;
1891M_API
char *
M_str_hexdump(
int flags,
size_t bytes_per_line,
const char *line_prefix,
const unsigned char *data,
size_t data_len);
M_bool(* M_chr_predicate_func)(char c)
Definition: m_chr.h:134
M_bool M_str_isnotcharset(const char *str, const char *charset)
M_bool M_str_eq_end(const char *s1, const char *s2)
M_bool M_str_isprint_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
int M_str_cmpsort_max(const char *s1, const char *s2, size_t max) M_WARN_UNUSED_RESULT
int M_str_casecmpsort_max(const char *s1, const char *s2, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_ispredicate(const char *s, M_chr_predicate_func pred)
M_bool M_str_isalpha_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_caseeq_end(const char *s1, const char *s2)
M_bool M_str_isspace(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_isalnum_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_isalpha(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_caseeq(const char *s1, const char *s2)
M_bool M_str_pattern_match(const char *pattern, const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_isspace_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_isnum_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_isdec(const char *s) M_WARN_UNUSED_RESULT
const char * M_str_safe(const char *s)
M_bool M_str_isempty(const char *s) M_WARN_UNUSED_RESULT
size_t M_str_len_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_eq(const char *s1, const char *s2)
M_bool M_str_isnum(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_isdec_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_isgraph_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_isalnumsp_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_eq_max(const char *s1, const char *s2, size_t max)
M_bool M_str_isgraph(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_ismoney(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_isalphasp_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
M_bool M_str_caseeq_start(const char *s1, const char *s2)
int M_str_casecmpsort(const char *s1, const char *s2) M_WARN_UNUSED_RESULT
M_bool M_str_eq_start(const char *s1, const char *s2)
M_bool M_str_isalnum(const char *s) M_WARN_UNUSED_RESULT
size_t M_str_len(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_caseeq_max(const char *s1, const char *s2, size_t max)
M_bool M_str_isalphasp(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_istrue(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_ishex_max(const char *s, size_t max) M_WARN_UNUSED_RESULT
int M_str_cmpsort(const char *s1, const char *s2) M_WARN_UNUSED_RESULT
M_bool M_str_isalnumsp(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_isprint(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_case_pattern_match(const char *pattern, const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_ispredicate_max(const char *s, size_t max, M_chr_predicate_func pred)
M_bool M_str_isstr(const unsigned char *s, size_t len)
M_bool M_str_ishex(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_isascii(const char *s) M_WARN_UNUSED_RESULT
M_bool M_str_ischarset(const char *str, const char *charset)
char * M_str_hexdump(int flags, size_t bytes_per_line, const char *line_prefix, const unsigned char *data, size_t data_len)
M_int64 M_str_to_int64(const char *s) M_WARN_UNUSED_RESULT
M_uint64 M_str_to_uint64(const char *s) M_WARN_UNUSED_RESULT
M_str_int_retval_t M_str_to_int32_ex(const char *s, size_t len, unsigned char base, M_int32 *val, const char **endptr)
M_str_int_retval_t M_str_to_int64_ex(const char *s, size_t len, unsigned char base, M_int64 *val, const char **endptr)
char * M_str_dot_money_out(const char *amount)
M_str_hexdump_flags
Definition: m_str.h:1871
M_str_int_retval_t
Definition: m_str.h:1719
M_uint32 M_str_to_uint32(const char *s) M_WARN_UNUSED_RESULT
long M_atofi100(const char *s) M_WARN_UNUSED_RESULT
M_int32 M_str_to_int32(const char *s) M_WARN_UNUSED_RESULT
M_str_int_retval_t M_str_to_uint32_ex(const char *s, size_t len, unsigned char base, M_uint32 *val, const char **endptr)
M_int64 M_atofi_prec(const char *s, int impliedDecimals) M_WARN_UNUSED_RESULT
M_str_int_retval_t M_str_to_uint64_ex(const char *s, size_t len, unsigned char base, M_uint64 *val, const char **endptr)
@ M_STR_HEXDUMP_DECLEN
Definition: m_str.h:1873
@ M_STR_HEXDUMP_NOASCII
Definition: m_str.h:1874
@ M_STR_HEXDUMP_CRLF
Definition: m_str.h:1877
@ M_STR_HEXDUMP_NOSECTS
Definition: m_str.h:1879
@ M_STR_HEXDUMP_UPPER
Definition: m_str.h:1878
@ M_STR_HEXDUMP_HEADER
Definition: m_str.h:1875
@ M_STR_HEXDUMP_NONE
Definition: m_str.h:1872
@ M_STR_HEXDUMP_NOLEN
Definition: m_str.h:1876
@ M_STR_INT_INVALID
Definition: m_str.h:1722
@ M_STR_INT_SUCCESS
Definition: m_str.h:1720
@ M_STR_INT_OVERFLOW
Definition: m_str.h:1721
char * M_strdup_trim_max(const char *s, size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_lower(const char *s) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_title(const char *s) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_unquote(const char *s, unsigned char quote, unsigned char escape) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_unquote_max(const char *s, unsigned char quote, unsigned char escape, size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_lower_max(const char *s, size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_upper(const char *s) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup(const char *s) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_upper_max(const char *s, size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC
M_str_justify_type_t
Definition: m_str.h:714
char * M_strdup_max(const char *s, size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_replace_charset(const char *s, const unsigned char *bcs, size_t bcs_len, const char *a)
char * M_strdup_replace_str(const char *s, const char *b, const char *a)
char * M_strdup_trim(const char *s) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_justify(const char *src, M_str_justify_type_t justtype, unsigned char justchar, size_t justlen) M_WARN_UNUSED_RESULT M_MALLOC
char * M_strdup_title_max(const char *s, size_t max) M_ALLOC_SIZE(2) M_WARN_UNUSED_RESULT M_MALLOC
@ M_STR_JUSTIFY_TRUNC_RIGHT
Definition: m_str.h:729
@ M_STR_JUSTIFY_CENTER
Definition: m_str.h:733
@ M_STR_JUSTIFY_LEFT
Definition: m_str.h:717
@ M_STR_JUSTIFY_TRUNC_LEFT
Definition: m_str.h:731
@ M_STR_JUSTIFY_END
Definition: m_str.h:740
@ M_STR_JUSTIFY_LEFT_TRUNC_RIGHT
Definition: m_str.h:721
@ M_STR_JUSTIFY_CENTER_TRUNC_RIGHT
Definition: m_str.h:735
@ M_STR_JUSTIFY_LEFT_NOTRUNC
Definition: m_str.h:726
@ M_STR_JUSTIFY_RIGHT_TRUNC_RIGHT
Definition: m_str.h:719
@ M_STR_JUSTIFY_RIGHT
Definition: m_str.h:715
@ M_STR_JUSTIFY_CENTER_NO_TRUNC
Definition: m_str.h:737
@ M_STR_JUSTIFY_RIGHT_NOTRUNC
Definition: m_str.h:723
char * M_str_trim_max(char *s, size_t max)
M_bool M_str_cpy(char *dest, size_t dest_len, const char *src)
char * M_str_remove_bracketed(const char *src, char open, char close) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_keep_quoted(const char *src, char quote_char, char escape_char) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_keep_bracketed(const char *src, char open, char close) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_keep_bracketed_quoted(const char *src, char open, char close, char quote, char escape) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_remove_bracketed_quoted(const char *src, char open, char close, char quote, char escape) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_lower_max(char *s, size_t max)
char * M_str_quote_max(const char *s, unsigned char quote, unsigned char escape, size_t max) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_unquote(char *s, unsigned char quote, unsigned char escape)
char * M_str_lower(char *s)
M_bool M_str_cat(char *dest, size_t dest_len, const char *src)
M_bool M_str_quote_if_necessary(char **out, const char *s, unsigned char quote, unsigned char escape, unsigned char delim)
char * M_str_replace_chr(char *s, char b, char a)
char * M_str_upper(char *s)
char * M_str_remove_quoted(const char *src, char quote_char, char escape_char) M_WARN_UNUSED_RESULT M_MALLOC
size_t M_str_justify(char *dest, size_t destlen, const char *src, M_str_justify_type_t justtype, unsigned char justchar, size_t justlen)
size_t M_str_justify_max(char *dest, size_t destlen, const char *src, size_t srclen, M_str_justify_type_t justtype, unsigned char justchar, size_t justlen)
char * M_str_delete_spaces(char *s)
char * M_str_quote(const char *s, unsigned char quote, unsigned char escape) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_delete_newlines(char *s)
char * M_str_unquote_max(char *s, unsigned char quote, unsigned char escape, size_t max)
char * M_str_upper_max(char *s, size_t max)
char * M_str_title_max(char *s, size_t max)
char * M_str_title(char *s)
char * M_str_trim(char *s)
M_bool M_str_cpy_max(char *dest, size_t dest_len, const char *src, size_t src_len)
char ** M_str_explode_str_quoted(unsigned char delim, const char *s, unsigned char quote_char, unsigned char escape_char, size_t max_sects, size_t *num) M_WARN_UNUSED_RESULT M_MALLOC
char ** M_str_explode(unsigned char delim, const char *s, size_t s_len, size_t *num, size_t **len_array) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_split_on_char(char *s, char c)
void M_str_explode_free(char **strs, size_t num) M_FREE(1)
char * M_str_implode(unsigned char delim, unsigned char enclose_char, unsigned char escape_char, char **strs, size_t num_strs, M_bool always_enclose) M_WARN_UNUSED_RESULT M_MALLOC
char ** M_str_explode_lines(size_t max_lines, size_t max_chars, const char *src_str, M_bool truncate, size_t *num) M_WARN_UNUSED_RESULT M_MALLOC
char ** M_str_explode_quoted(unsigned char delim, const char *s, size_t s_len, unsigned char quote_char, unsigned char escape_char, size_t max_sects, size_t *num, size_t **len_array) M_WARN_UNUSED_RESULT M_MALLOC
char ** M_str_explode_str(unsigned char delim, const char *s, size_t *num) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_implode_int(unsigned char delim, const int *ints, size_t num_ints) M_WARN_UNUSED_RESULT M_MALLOC
int * M_str_explode_int(unsigned char delim, const char *s, size_t *num) M_WARN_UNUSED_RESULT M_MALLOC
char * M_str_chr(const char *s, char c) M_WARN_UNUSED_RESULT
char * M_str_rchr(const char *s, char c) M_WARN_UNUSED_RESULT
ssize_t M_str_casestr_pos(const char *haystack, const char *needle) M_WARN_UNUSED_RESULT
char * M_str_casestr(const char *haystack, const char *needle) M_WARN_UNUSED_RESULT
char * M_str_str(const char *haystack, const char *needle) M_WARN_UNUSED_RESULT
char * M_str_find_first_not_from_charset(const char *str, const char *charset)
char * M_str_find_first_from_charset(const char *str, const char *charset)