is_number

C++ Function Reference

1 Signature

bool BigDataStatMeth::is_number(const std::string &s)

2 Description

Tests if a string represents a valid number.

3 Parameters

  • s (const std::string &): String to test

4 Returns

bool True if string represents a valid number, false otherwise

5 Details

sString to test bool True if string represents a valid number, false otherwiseHandles both integer and floating-point representations Also validates against overflow conditions

6 Source Code

File: inst/include/hdf5Utilities/hdf5ImportFiles.hppLines 113-119

inline bool is_number(const std::string& s)
    {
        char* end = nullptr;
        double val = strtod(s.c_str(), &end);

        return end != s.c_str() && *end == '\0' && val != HUGE_VAL;
    }

7 Usage Example

#include "BigDataStatMeth.hpp"

// Example usage
auto result = is_number(...);