Functions to convert between integers and strings.
More...
Functions to convert between integers and strings.
◆ Thingstream_Util_parseHex()
uint32_t Thingstream_Util_parseHex |
( |
const char * |
ptr, |
|
|
const char * |
end, |
|
|
const char ** |
pOut |
|
) |
| |
A helper to parse a sequence of ascii digits as a hex number.
- Parameters
-
ptr | start of sequence |
end | end of sequence, or NULL to parse until non-digit character |
pOut | if non-NULL, address of first non-digit is written here |
◆ Thingstream_Util_parseInt()
int32_t Thingstream_Util_parseInt |
( |
const char * |
ptr, |
|
|
const char * |
end, |
|
|
const char ** |
pOut |
|
) |
| |
A helper to parse a sequence of ascii digits as a signed decimal number.
- Parameters
-
ptr | start of sequence |
end | end of sequence, or NULL to parse until non-digit character |
pOut | if non-NULL, address of first non-digit is written here |
◆ Thingstream_Util_parseUInt()
uint32_t Thingstream_Util_parseUInt |
( |
const char * |
ptr, |
|
|
const char * |
end, |
|
|
const char ** |
pOut |
|
) |
| |
A helper to parse a sequence of ascii digits as an unsigned decimal number.
- Parameters
-
ptr | start of sequence |
end | end of sequence, or NULL to parse until non-digit character |
pOut | if non-NULL, address of first non-digit is written here |
◆ Thingstream_Util_sprintfHex()
char* Thingstream_Util_sprintfHex |
( |
char * |
buf, |
|
|
uint32_t |
num |
|
) |
| |
Convert an integer to an unsigned base-16 string representation. A helper routine to avoid pulling in the large sprintf() library. Note that the result is not 0-terminated.
- Parameters
-
buf | buffer to receive the string - assumed to be big enough to hold largest possible uint32_t value (8 bytes). |
num | the number to be converted |
- Returns
- a pointer to just after the last byte of the conversion.
◆ Thingstream_Util_sprintfUInt()
char* Thingstream_Util_sprintfUInt |
( |
char * |
buf, |
|
|
uint32_t |
num |
|
) |
| |
Convert an integer to an unsigned base-10 string representation. A helper routine to avoid pulling in the large sprintf() library. Note that the result is not 0-terminated.
- Parameters
-
buf | buffer to receive the string - assumed to be big enough to hold largest possible uint32_t value (10 bytes). |
num | the number to be converted |
- Returns
- a pointer to just after the last byte of the conversion.