StrSwapCharAt
Description
Swap the characters at two given indices in place. idx1 and idx2 must lie in [0, length). See VecSwapItems for the full SUCCESS/FAILURE contract.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.Memory.c:47:
// Test StrSwapCharAt function
bool test_str_swap_char_at(void) {
WriteFmt("Testing StrSwapCharAt\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Str.Memory.c:54:
// Swap 'H' and 'o'
StrSwapCharAt(&s, 0, 4);
// Check that the characters were swapped
- In
Str.Memory.c:60:
// Swap 'e' and 'l'
StrSwapCharAt(&s, 1, 2);
// Check that the characters were swapped
Last updated on