StrRemove
- Macro
- August 22, 2025
Table of Contents
StrRemove
StrRemove
Description
Remove char from string at given index and store in given pointer.
Parameters
Name | Direction | Description |
---|---|---|
str | in,out | Str to remove char from. |
val | out | Where removed char will be stored. If not provided then it’s equivalent to deleting the char at specified index. |
idx | in | Index in string to remove char from. |
Success
Returns str
on success.
Failure
Returns NULL otherwise.
Usage example (Cross-references)
- In
Str.Remove.c:69
:
// Test StrRemove function
bool test_str_remove(void) {
printf("Testing StrRemove\n");
Str s = StrInitFromZstr("Hello");
- In
Str.Remove.c:75
:
// Remove a character from the middle
char c;
StrRemove(&s, &c, 2);
// Check that the character was removed correctly
- In
Str.Remove.c:82
:
// Remove another character without storing it - avoid passing NULL directly
char ignored;
StrRemove(&s, &ignored, 1);
// Check that the character was removed