StrMergeR
- Macro
- August 22, 2025
Table of Contents
StrMergeR
StrMergeR
Description
Merge two strings and store the result in first string, with R-value semantics. Data is copied from str2
into str
. If a copy_init
method is provided in str
, each element from str2
will be copied using that method. Otherwise, a raw memory copy is performed.
Note
Unlike StrMergeL, this does NOT zero out the source string’s data after merging.
Parameters
Name | Direction | Description |
---|---|---|
str | in,out | Str to insert array chars into. |
str2 | in | Str to be inserted. |
Success
str
Failure
NULL
Usage example (Cross-references)
- In
Insert.h:217
:
/// FAILURE : NULL
///
#define StrMerge(str, str2) StrMergeR((str), (str2))
///
- In
Str.Insert.c:271
:
// Test StrMergeR function
bool test_str_merge_r(void) {
printf("Testing StrMergeR\n");
Str s1 = StrInitFromZstr("Hello");
- In
Str.Insert.c:277
:
// Merge s2 into s1 (R-value semantics)
StrMergeR(&s1, &s2);
// Check that the strings were merged correctly