JReadBool

Table of Contents

JReadBool

Description

Read a boolean value (“true” or “false”) from input string.

Parameters

NameDirectionDescription
siinCurrent reading position in input string
boutPointer to bool to store parsed result

Success

Returns StrIter advanced past parsed boolean

Failure

Returns original StrIter if invalid or unrecognized value

Usage example (Cross-references)

    do {                                                                                                               \
    bool my_b = 0;                                                                                                 \
    si        = JReadBool((si), &my_b);                                                                            \
    (b)       = my_b;                                                                                              \
    } while (0)
    if (!StrCmpZstr(&key, (k))) {                                                                                  \
    bool my_b = 0;                                                                                             \
    si        = JReadBool((si), &my_b);                                                                        \
    (b)       = my_b;                                                                                          \
    }                                                                                                              \
    }
    
    StrIter JReadBool(StrIter si, bool* b) {
    if (!StrIterRemainingLength(&si)) {
    return si;
    StrIter before_si = si;
    bool    b;
    si = JReadBool(si, &b);
    
    if (si.pos == before_si.pos) {

Share :

Related Posts

JReadNumber

JReadNumber Description Read a JSON number (int or float) from input string.

Read More

JReadFloat

JReadFloat Description Read a floating-point number from input string.

Read More

JReadInteger

JReadInteger Description Strictly read an integer from input string.

Read More