ZstrLen

Table of Contents

ZstrLen

Description

Get length of a null-terminated string.

Parameters

NameDirectionDescription
strinNull-terminated string.

Success

Returns number of characters before null terminator.

Failure

Function cannot fail if str is valid.

Usage example (Cross-references)

    }
    
    size ZstrLen(const char* str) {
    if (!str) {
    LOG_FATAL("Invalid arguments");
    
    char* ZstrDup(const char* src) {
    return ZstrDupN(src, ZstrLen(src));
    }
    
    // Calculate haystack length
    size haystack_len = ZstrLen(haystack);
    
    // Search through haystack
    const char* p         = fmtstr;
    const char* in        = input;
    size        remaining = ZstrLen(fmtstr);
    size        arg_index = 0; // Current argument index
    } else {
    // Get string length
    size len = ZstrLen(xs);
    
    // If precision is specified, use it as max length
    
    StrIters sv     = VecInit();
    size     keylen = ZstrLen(key);
    
    const char* prev = s->data;
    
    Strs sv     = VecInitWithDeepCopy(NULL, StrDeinit);
    size keylen = ZstrLen(key);
    
    const char* prev = s->data;
    bool StrStartsWithZstr(const Str* s, const char* prefix) {
    ValidateStr(s);
    return starts_with(s->data, s->length, prefix, ZstrLen(prefix));
    }
    bool StrEndsWithZstr(const Str* s, const char* suffix) {
    ValidateStr(s);
    return ends_with(s->data, s->length, suffix, ZstrLen(suffix));
    }
    void StrReplaceZstr(Str* s, const char* match, const char* replacement, size count) {
    ValidateStr(s);
    str_replace(s, match, ZstrLen(match), replacement, ZstrLen(replacement), count);
    }
    // Copy name
    if (src->name) {
    size name_len = ZstrLen(src->name);
    dst->name     = malloc(name_len + 1);
    if (!dst->name)

Share :

Related Posts

JW_STR_KV

JW_STR_KV Description Write a key and string value into a JSON object.

Read More

MemCompare

MemCompare Description Compare memory regions.

Read More

JR_STR_KV

JR_STR_KV Description Read a string key-value pair if key matches.

Read More