Skip to content

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.

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)

Usage examples (Cross-references)
    // Test StrMergeR function
    bool test_str_merge_r(void) {
        WriteFmt("Testing StrMergeR\n");
    
        Str s1 = StrInitFromZstr("Hello");
    
        // Merge s2 into s1 (R-value semantics)
        StrMergeR(&s1, &s2);
    
        // Check that the strings were merged correctly
    /// FAILURE : NULL
    ///
    #define StrMerge(str, str2) StrMergeR((str), (str2))
    
        ///
Last updated on