DvG_StreamCommand
DvG_StreamCommand.cpp File Reference

Functions

float parseFloatInString (const char *str_in, uint16_t pos)
 Safely parse a float value in C-string str_in from of position pos. More...
 
bool parseBoolInString (const char *str_in, uint16_t pos)
 Safely parse a boolean value in C-string str_in from of position pos. More...
 
int parseIntInString (const char *str_in, uint16_t pos)
 Safely parse an integer value in C-string str_in from of position pos. More...
 

Detailed Description

Function Documentation

◆ parseFloatInString()

float parseFloatInString ( const char *  str_in,
uint16_t  pos = 0 
)

Safely parse a float value in C-string str_in from of position pos.

Returns
The parsed float value when successful, 0.0 otherwise.
Examples
StreamCommand.ino.

◆ parseBoolInString()

bool parseBoolInString ( const char *  str_in,
uint16_t  pos = 0 
)

Safely parse a boolean value in C-string str_in from of position pos.

Returns
  • False, when str_in is empty or pos is past the str_in length.
  • True, when the string perfectly matches 'true', 'True' or 'TRUE'.
  • Else, it will interpret the string as an integer, where 0 is considered to be false and all other integers are considered be true. Leading spaces, zeros or signs will be ignored from the integer.
Examples
StreamCommand.ino.

◆ parseIntInString()

int parseIntInString ( const char *  str_in,
uint16_t  pos = 0 
)

Safely parse an integer value in C-string str_in from of position pos.

Returns
The parsed integer value when successful, 0 otherwise.
Examples
StreamCommand.ino.