Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Group_string_func

Group_string_func

The string utilities module is a collection of string conversion helpers to convert between integer and strings. More...

Functions

uint32_t cy_generic_string_to_unsigned (const char *str)
uint8_t cy_string_to_signed (const char *string, uint16_t str_length, int32_t *value_out, uint8_t is_hex)
 Converts a decimal/hexidecimal string (with optional sign) to a signed long int Better than strtol or atol or atoi because the return value indicates if an error occurred.
uint8_t cy_string_to_unsigned (const char *string, uint8_t str_length, uint32_t *value_out, uint8_t is_hex)
 Converts a decimal/hexidecimal string to an unsigned long int Better than strtol or atol or atoi because the return value indicates if an error occurred.

Detailed Description

The string utilities module is a collection of string conversion helpers to convert between integer and strings.


Function Documentation

uint32_t cy_generic_string_to_unsigned ( const char *  str )

Convert a decimal or hexidecimal string to an integer.

Parameters:
[in]strThe string containing the value.
Returns:
The value represented by the string.

Definition at line 162 of file cy_string_utils.c.

uint8_t cy_string_to_signed ( const char *  string,
uint16_t  str_length,
int32_t *  value_out,
uint8_t  is_hex 
)

Converts a decimal/hexidecimal string (with optional sign) to a signed long int Better than strtol or atol or atoi because the return value indicates if an error occurred.

Parameters:
[in]string: The string buffer to be converted
[in]str_length: The maximum number of characters to process in the string buffer
[out]value_out: The unsigned in that will receive value of the the decimal string
[in]is_hex: 0 = Decimal string, 1 = Hexidecimal string
Returns:
the number of characters successfully converted (including sign). i.e. 0 = error
Parameters:
string[in]: The string buffer to be converted
str_length[in]: The maximum number of characters to process in the string buffer
value_out[out]: The unsigned in that will receive value of the the decimal string
is_hex[in]: 0 = Decimal string, 1 = Hexidecimal string
Returns:
the number of characters successfully converted (including sign). i.e. 0 = error

Definition at line 190 of file cy_string_utils.c.

uint8_t cy_string_to_unsigned ( const char *  string,
uint8_t  str_length,
uint32_t *  value_out,
uint8_t  is_hex 
)

Converts a decimal/hexidecimal string to an unsigned long int Better than strtol or atol or atoi because the return value indicates if an error occurred.

Parameters:
[in]string: The string buffer to be converted
[in]str_length: The maximum number of characters to process in the string buffer
[out]value_out: The unsigned in that will receive value of the the decimal string
[in]is_hex: 0 = Decimal string, 1 = Hexidecimal string
Returns:
the number of characters successfully converted. i.e. 0 = error
Parameters:
string[in]: The string buffer to be converted
str_length[in]: The maximum number of characters to process in the string buffer
value_out[out]: The unsigned in that will receive value of the the decimal string
is_hex[in]: 0 = Decimal string, 1 = Hexidecimal string
Returns:
the number of characters successfully converted. i.e. 0 = error

Definition at line 235 of file cy_string_utils.c.