PebbleOS
Loading...
Searching...
No Matches
Macros | Functions
string.h File Reference
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>

Macros

#define IS_EMPTY_STRING(s)   (s[0] == '\0')
 Check whether a string is empty.
 
#define GET_FILE_NAME(file)   (strrchr(file, '/') ? (strrchr(file, '/') + 1) : (file))
 Get the file name part of a path.
 

Functions

size_t strnlen (const char *, size_t)
 POSIX strnlen(), declared here because newlib's string.h does not always declare it.
 
const char * string_strip_leading_whitespace (const char *string)
 Skip leading spaces and newlines.
 
void string_strip_trailing_whitespace (const char *string, char *string_out)
 Copy a string without its trailing spaces and newlines.
 
void string_itoa (uint32_t num, char *buffer, int buffer_length)
 Format an unsigned integer as "0x" followed by 8 hex digits.
 
void itoa_int (int n, char *str, int base)
 Format a signed integer.
 
void string_reverse (char *str)
 Reverse a string in place.
 
uintptr_t str_to_address (const char *address_str)
 Parse an address.
 
const char * bool_to_str (bool b)
 Format a boolean.
 
bool convert_bt_addr_hex_str_to_bd_addr (const char *hex_str, uint8_t *bd_addr, const unsigned int bd_addr_size)
 Parse a Bluetooth address from a hex string.
 
void concat_str_int (const char *str, uint32_t num, char *buf, uint8_t buf_len)
 Concatenate a string and a decimal number.
 
void toupper_str (char *str)
 Convert an ASCII string to uppercase in place.
 
void byte_stream_to_hex_string (char *out_buf, size_t out_buf_len, const uint8_t *byte_stream, size_t byte_stream_len, bool stream_backward)
 Format bytes as lowercase hex, e.g.
 
void safe_strcat (char *dst, const char *src, int dst_space)
 Append a string, truncating to the size of the destination buffer.