StrInitFromStr

Table of Contents

StrInitFromStr

Description

Initialize a Str object using another one

Usage example (Cross-references)

    // Test StrInitFromStr function
    bool test_str_init_from_str(void) {
    WriteFmt("Testing StrInitFromStr\n");
    
    Str src = StrInitFromZstr("Hello, World!");
    
    Str src = StrInitFromZstr("Hello, World!");
    Str dst = StrInitFromStr(&src);
    
    // Validate both strings
    ///
    #define StrInitFromStr(str) StrInitFromCstr((str)->data, (str)->length)
    #define StrDup(str)         StrInitFromStr(str)
    
    ///
    case STR_INIT_FROM_STR : {
    if (VecLen(str) > 0) {
    Str temp = StrInitFromStr(str);
    StrDeinit(str);
    *str = temp;

Share :