StrPushFrontCstr

Table of Contents

StrPushFrontCstr

Description

Push a array of characters with given length to the front of this string

Parameters

NameDirectionDescription
strin,outStr to insert array chars into.
cstrinarray of characters with given length to be inserted.

Success

str

Failure

NULL

Usage example (Cross-references)

    /// FAILURE : NULL
    ///
    #define StrPushFrontZstr(str, zstr) StrPushFrontCstr((str), (zstr), strlen((zstr)))
    
    ///
    StrPushFront(&output_path, '/');
    LOG_INFO("{}", output_path);
    StrPushFrontCstr(&output_path, project.build_dir.data, project.build_dir.length);
    LOG_INFO("{}", output_path);
    StrReplaceZstr(&output_path, ".c", ".md", 1);
    // Test StrPushFrontCstr function
    bool test_str_push_front_cstr(void) {
    printf("Testing StrPushFrontCstr\n");
    
    Str s = StrInitFromZstr("World");
    
    // Push a string at the front
    StrPushFrontCstr(&s, "Hello ", 6);
    
    // Check that the string was inserted correctly

Share :