Skip to content

StrEmpty

StrEmpty

Description

Check whether string is empty.

Parameters

Name Direction Description
str in String to query.

Success

true when string length is 0.

Failure

false

Usage example (Cross-references)

Usage examples (Cross-references)
    // Test StrLen and StrEmpty functions
    bool test_str_len_empty(void) {
        WriteFmt("Testing StrLen and StrEmpty\n");
    
        Str s = StrInit();
    
        bool result = (StrLen(&s) == 0);
        result      = result && StrEmpty(&s);
    
        StrPushBack(&s, 'H');
    
        result = result && (StrLen(&s) == 2);
        result = result && !StrEmpty(&s);
    
        StrClear(&s);
        StrClear(&s);
        result = result && (StrLen(&s) == 0);
        result = result && StrEmpty(&s);
    
        StrDeinit(&s);
Last updated on