StrPopBack
StrPopBack
Description
Pop char from string back.
Parameters
| Name | Direction | Description |
|---|---|---|
str |
in,out | Str to pop char from. |
val |
out | Popped char will be stored here. Make sure this has sufficient memory to store memcopied data. If no pointer is provided, then it’s equivalent to deleting char from last position. |
Success
Returns str on success
Failure
Returns NULL otherwise.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.c:351:
if (VecLen(str) > 0) {
char ch;
StrPopBack(str, &ch);
(void)ch; // Suppress unused variable warning
}- In
KvConfig.c:274:
while (value->length > 0 && kvconfig_is_space(value->data[value->length - 1])) {
char dropped = '\0';
StrPopBack(value, &dropped);
}
return si;- In
Str.Remove.c:21:
// Test StrPopBack function
bool test_str_pop_back(void) {
WriteFmt("Testing StrPopBack\n");
Str s = StrInitFromZstr("Hello");- In
Str.Remove.c:27:
// Pop a character from the back
char c;
StrPopBack(&s, &c);
// Check that the character was popped correctly
- In
Str.Remove.c:34:
// Pop another character without storing it - avoid passing NULL directly
char ignored;
StrPopBack(&s, &ignored);
// Check that the character was removed
Last updated on