StrPopBack
Description
Remove the last character from the string and optionally store it. Pass NULL for chr to discard. See VecPopBack for the full SUCCESS/FAILURE contract.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
KvConfig.c:200:
while (StrLen(value) > 0 && kvconfig_is_space(StrCharAt(value, StrLen(value) - 1))) {
char dropped = '\0';
StrPopBack(value, &dropped);
}
return si;- In
Str.Remove.c:22:
// Test StrPopBack function
bool test_str_pop_back(void) {
WriteFmt("Testing StrPopBack\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Str.Remove.c:30:
// Pop a character from the back
char c;
StrPopBack(&s, &c);
// Check that the character was popped correctly
- In
Str.Remove.c:37:
// Pop another character without storing it - avoid passing NULL directly
char ignored;
StrPopBack(&s, &ignored);
// Check that the character was removed
Last updated on