RTI Connext Micro C API Version 4.3.0
Loading...
Searching...
No Matches
OSAPI String API

String Interface. More...

Functions

RTI_SIZE_T OSAPI_String_length (const char *s)
 Return length of ASCIIZ string.
 
RTI_INT32 OSAPI_String_cmp (const char *left, const char *right)
 Compare two ASCIIZ strings.
 
RTI_INT32 OSAPI_String_ncmp (const char *left, const char *right, RTI_SIZE_T num)
 Compare at most num characters of two ASCII strings.
 
RTI_BOOL OSAPI_String_parse_unsigned_long (const char *str, unsigned int *result)
 Parse an unsigned long integer from a string.
 
RTI_BOOL OSAPI_String_parse_unsigned_long_long (const char *str, unsigned long long int *result)
 Parse an unsigned long long integer from a string.
 
int OSAPI_String_char_to_lowercase (const int c)
 Convert a character to lowercase.
 
char * OSAPI_String_strchr (const char *s, int c)
 Locate character in string.
 
RTI_SIZE_T OSAPI_String_length_w_max (const char *s, RTI_SIZE_T max)
 Return length of ASCII string with maximum limit.
 

Detailed Description

String Interface.

Function Documentation

◆ OSAPI_String_length()

RTI_SIZE_T OSAPI_String_length ( const char * s)

Return length of ASCIIZ string.

Return length of ASCIIZ string not including \0.

Parameters
s<<in>> Pointer to beginning of byte string.
Returns
Length of string not including \0.

References RTI_INT32.

◆ OSAPI_String_cmp()

RTI_INT32 OSAPI_String_cmp ( const char * left,
const char * right )

Compare two ASCIIZ strings.

Lexicographically compare the null-terminated strings left and right. The comparison is using unsigned arithmetic.

Parameters
left<<in>> Left side string.
right<<in>> Right side string.
Returns
0 if the strings are identical, a positive integer if left is greater then right, and a negative integer if left less then right.

References RTI_INT32.

◆ OSAPI_String_ncmp()

RTI_INT32 OSAPI_String_ncmp ( const char * left,
const char * right,
RTI_SIZE_T num )

Compare at most num characters of two ASCII strings.

Lexicographically compare null-terminated strings left and right, including up to num characters (if the null terminator is not found before the specified number of characters has been compared). The comparison uses unsigned arithmetic.

Parameters
left<<in>> Left side string.
right<<in>> Right side string.
num<<in>> Maximum number of characters to compare.
Returns
0 if the strings are identical, a positive integer if left is greater than right, and a negative integer if left is less than right.

◆ OSAPI_String_parse_unsigned_long()

RTI_BOOL OSAPI_String_parse_unsigned_long ( const char * str,
unsigned int * result )

Parse an unsigned long integer from a string.

Parameters
[in]strNull-terminated string to parse. Cannot be NULL.
[out]resultPointer to store the parsed unsigned integer. Cannot be NULL. Only valid if RTI_TRUE is returned.
Returns
RTI_TRUE if the string was successfully parsed, RTI_FALSE otherwise.

◆ OSAPI_String_parse_unsigned_long_long()

RTI_BOOL OSAPI_String_parse_unsigned_long_long ( const char * str,
unsigned long long int * result )

Parse an unsigned long long integer from a string.

Parameters
[in]strNull-terminated string to parse. Cannot be NULL.
[out]resultPointer to store the parsed unsigned long long integer. Cannot be NULL. Only valid if RTI_TRUE is returned.
Returns
RTI_TRUE if the string was successfully parsed, RTI_FALSE otherwise.

◆ OSAPI_String_char_to_lowercase()

int OSAPI_String_char_to_lowercase ( const int c)

Convert a character to lowercase.

Parameters
[in]cCharacter to convert. Must be representable as an unsigned char or equal to EOF.
Returns
The lowercase equivalent of c if c is an uppercase letter, otherwise c is returned unchanged.
MT Safety:
SAFE

◆ OSAPI_String_strchr()

char * OSAPI_String_strchr ( const char * s,
int c )

Locate character in string.

Parameters
[in]sNull-terminated string to search. Cannot be NULL.
[in]cCharacter to search for.
Returns
Pointer to the first occurrence of c in s, or NULL if c is not found.

◆ OSAPI_String_length_w_max()

RTI_SIZE_T OSAPI_String_length_w_max ( const char * s,
RTI_SIZE_T max )

Return length of ASCII string with maximum limit.

Return the length of a null-terminated string.

Parameters
[in]sPointer to beginning of byte string. Cannot be NULL.
[in]maxMaximum number of characters to examine.
Returns
Length of string not including '\0' if null terminator is found within max characters, otherwise max.
MT Safety:
SAFE