Skip to content

Commit

Permalink
lib: str - Add str_replace().
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbosch committed Mar 19, 2019
1 parent 9d3389f commit b2e90e7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/str.h
Expand Up @@ -70,6 +70,12 @@ static inline void str_delete(string_t *str, size_t pos, size_t len)
buffer_delete(str, pos, len);
}

static inline void str_replace(string_t *str, size_t pos, size_t len,
const char *cstr)
{
buffer_replace(str, pos, len, cstr, strlen(cstr));
}

/* Truncate the string to specified length. If it's already smaller,
do nothing. */
static inline void str_truncate(string_t *str, size_t len)
Expand Down

0 comments on commit b2e90e7

Please sign in to comment.