IS_SPACE

Table of Contents

IS_SPACE

Description

Checks if the given character c is a whitespace character.

Parameters

NameDirectionDescription
cinThe character to check.

Success

Returns true for space, tab, newline, carriage return, vertical tab, form feed.

Failure

Function cannot fail - always returns boolean result.

Usage example (Cross-references)

    ///
    /// TAGS: Character, ASCII, Printable
    #define IS_PRINTABLE(c) (IN_RANGE(c, 0x20, 0x7e) || IS_SPACE(c))
    
    ///
    bool        is_caps    = fmt_info && (fmt_info->flags & FMT_FLAG_CAPS) != 0;
    
    while (bytes_read < buffer_size && *current && !IS_SPACE(*current)) {
    u8 char_to_store;
    
    // Skip leading whitespace
    while (IS_SPACE(*i))
    i++;
    } else {
    // Unquoted string mode - read until whitespace
    if (IS_SPACE(*i)) {
    return i; // Successfully read unquoted string
    }
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    // For special values, use the original approach
    const char* start = i;
    while (*i && !IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip leading whitespace
    while (IS_SPACE(*i))
    i++;
    
    // Skip whitespace
    while (IS_SPACE(*i))
    i++;
    // For special values, use the original approach
    const char* start = i;
    while (*i && !IS_SPACE(*i))
    i++;
    // Skip whitespace
    size_t pos = 0;
    while (pos < str->length && IS_SPACE(str->data[pos]))
    pos++;
    u8 digit;
    if (!char_to_digit(str->data[pos], &digit, base)) {
    if (IS_SPACE(str->data[pos]))
    break;
    LOG_ERROR("Invalid digit for base {}: {c}", base, str->data[pos]);
    
    // Skip trailing whitespace
    while (pos < str->length && IS_SPACE(str->data[pos]))
    pos++;
    // Skip whitespace
    size_t pos = 0;
    while (pos < str->length && IS_SPACE(str->data[pos]))
    pos++;
    // Skip whitespace
    size_t pos = 0;
    while (pos < str->length && IS_SPACE(str->data[pos]))
    pos++;
    
    if (c1 == 'n' && c2 == 'a' && c3 == 'n') {
    if (str->length - pos == 3 || IS_SPACE(str->data[pos + 3])) {
    *value = NAN;
    return true;
    }
    if (c1 == 'i' && c2 == 'n' && c3 == 'f') {
    if (str->length - pos == 3 || IS_SPACE(str->data[pos + 3])) {
    *value = INFINITY;
    return true;
    
    if (c1 == 'i' && c2 == 'n' && c3 == 'f') {
    if (str->length - pos == 3 || IS_SPACE(str->data[pos + 3])) {
    *value = -INFINITY;
    return true;
    
    // Skip trailing whitespace
    while (pos < str->length && IS_SPACE(str->data[pos]))
    pos++;

Share :

Related Posts

IS_DIGIT

IS_DIGIT Description Checks if the given character c is an ASCII digit.

Read More

IS_PRINTABLE

IS_PRINTABLE Description Checks whether a given character ‘c’ is printable ascii or not.

Read More

IS_ALPHA

IS_ALPHA Description Checks if the given character c is an ASCII alphabet.

Read More