DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
numparse.h File Reference

Tiny no-stdlib base-10 number parsers (strtol/strtoul/strtof replacements). More...

Go to the source code of this file.

Functions

bool det_np_ws (char c)
 
bool det_np_digit (char c)
 
long det_strtol (const char *s, const char **end)
 Parse a base-10 long; sets end past the digits (or to s if none).
 
unsigned long det_strtoul (const char *s, const char **end)
 Parse a base-10 unsigned long; sets end past the digits (or to s).
 
void det_strtod_frac (const char *&p, double &val, bool &any)
 
void det_strtod_exp (const char *&p, double &val)
 
double det_strtod (const char *s, const char **end)
 Parse a double (integer[.frac][e[+/-]exp]); sets end (or to s if none).
 
float det_strtof (const char *s, const char **end)
 Parse a float (integer[.frac][e[+/-]exp]); sets end (or to s if none).
 

Detailed Description

Tiny no-stdlib base-10 number parsers (strtol/strtoul/strtof replacements).

This library does not pull in <stdlib.h> - no heap, no locale, no bloat. These header-only inline helpers parse a base-10 integer / unsigned / float from a string, mirroring the strtol-family endptr contract: skip leading whitespace, accept an optional sign, consume digits, and (optionally) report where parsing stopped. If no digit is converted, *end is set to the original pointer (so callers can detect "no number") and the result is 0.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file numparse.h.

Function Documentation

◆ det_np_ws()

bool det_np_ws ( char  c)
inline

Definition at line 22 of file numparse.h.

Referenced by det_strtod(), det_strtol(), and det_strtoul().

◆ det_np_digit()

bool det_np_digit ( char  c)
inline

Definition at line 26 of file numparse.h.

Referenced by det_strtod(), det_strtod_exp(), det_strtod_frac(), det_strtol(), and det_strtoul().

◆ det_strtol()

long det_strtol ( const char *  s,
const char **  end 
)
inline

Parse a base-10 long; sets end past the digits (or to s if none).

Definition at line 32 of file numparse.h.

References det_np_digit(), and det_np_ws().

Referenced by json_get_int().

◆ det_strtoul()

unsigned long det_strtoul ( const char *  s,
const char **  end 
)
inline

Parse a base-10 unsigned long; sets end past the digits (or to s).

Definition at line 50 of file numparse.h.

References det_np_digit(), and det_np_ws().

◆ det_strtod_frac()

void det_strtod_frac ( const char *&  p,
double &  val,
bool &  any 
)
inline

Definition at line 67 of file numparse.h.

References det_np_digit().

Referenced by det_strtod().

◆ det_strtod_exp()

void det_strtod_exp ( const char *&  p,
double &  val 
)
inline

Definition at line 80 of file numparse.h.

References det_np_digit().

Referenced by det_strtod().

◆ det_strtod()

double det_strtod ( const char *  s,
const char **  end 
)
inline

Parse a double (integer[.frac][e[+/-]exp]); sets end (or to s if none).

Definition at line 99 of file numparse.h.

References det_np_digit(), det_np_ws(), det_strtod_exp(), and det_strtod_frac().

Referenced by det_strtof().

◆ det_strtof()

float det_strtof ( const char *  s,
const char **  end 
)
inline

Parse a float (integer[.frac][e[+/-]exp]); sets end (or to s if none).

Definition at line 124 of file numparse.h.

References det_strtod().