Substring modification

ss_string_splice is a function defined in ssstring.c.

Synopsis:

herr_t ss_string_splice(ss_string_t *str, const char *value, size_t start, size_t nbytes, size_t nreplace)

Formal Arguments:

  • str: String object to be modified by this operation.
  • value: Optional new data for part of the string value. If this argument is the null pointer and nbytes is positive then the new data will be all NUL characters (this allows for an easy way to extend the length of a string).
  • start: Byte offset at which to place the new data in the string.
  • nbytes: Length of the new data in bytes.
  • nreplace: Number of bytes replaced by the new data. If SS_NOSIZE is passed then all bytes from start to the end of the original value will be replaced by the new value.

Description: This function is able to modify a string value by modifying, inserting, or deleting bytes. It does not assume that value is a C-style NUL-terminated string.

Return Value: Returns non-negative on success; negative on failure.

Parallel Notes: Independent

See Also:

  • Strings: Introduction for current chapter