提交 dc42ac00 编写于 作者: J jp9000

Add dstr_end function to get the last character

上级 7303009f
......@@ -135,6 +135,8 @@ EXPORT void dstr_mid(struct dstr *dst, const struct dstr *str,
EXPORT void dstr_right(struct dstr *dst, const struct dstr *str,
const size_t pos);
static inline char dstr_end(const struct dstr *str);
EXPORT void dstr_from_mbs(struct dstr *dst, const char *mbstr);
EXPORT char *dstr_to_mbs(const struct dstr *str);
EXPORT void dstr_from_wcs(struct dstr *dst, const wchar_t *wstr);
......@@ -306,6 +308,14 @@ static inline int dstr_ncmpi(const struct dstr *str1, const char *str2,
return astrcmpi_n(str1->array, str2, n);
}
static inline char dstr_end(const struct dstr *str)
{
if (dstr_isempty(str))
return 0;
return str->array[str->len];
}
#ifdef __cplusplus
}
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册