mikroSDK Reference Manual
|
ANSI C String Library. More...
Functions list | |
const void * | memchr (const void *ptr, char ch, unsigned int num) |
Function locates the first occurrence of a character in a defined memory area starting with a given address. The function returns the pointer to this location or 0 if the n was not found. More... | |
int | memcmp (const void *str1, const void *str2, int num) |
Function compares a given number of characters inside of objects pointed to by str1 and str2, returns zero if the objects are equal, or returns a difference between the first differing characters (in a left-to-right evaluation). More... | |
void * | memcpy (void *dest_ptr, const void *src_ptr, int num) |
Function copies a given number of characters( num ) from the object pointed to by src_ptr into the object pointed to by dest_ptr. If copying takes place between objects that overlap, the behavior is undefined. The function returns address of the object pointed to by dest_ptr. More... | |
void * | memmove (void *dest_ptr, const void *src_ptr, int num) |
Function copies num characters from a object pointed to by src_ptr into a object pointed to by dest_ptr. Unlike memcpy, the memory areas to and from may overlap. The function returns address of the object pointed to. More... | |
void * | memset (void *ptr, char chr, int num) |
Function copies the value of the character into each of the first num characters of the object pointed by ptr. The function returns address of the object pointed to by ptr. More... | |
char * | strcat (char *dest_ptr, const char *src_ptr) |
Function appends a copy of the string src_ptr to the string dest_ptr, overwriting the null character at the end of dest_ptr. Then, a terminating null character is added to the result. If copying takes place between objects that overlap, the behavior is undefined. The string must have enough space to store the result. The function returns address of the object pointed to by dest_ptr. More... | |
const char * | strchr (const char *ptr, char chr) |
Function locates the first occurrence of character chr in the string ptr. The function returns a pointer to the first occurrence of character chr, or a null pointer if chr does not occur in ptr. The terminating null character is considered to be a part of the string. More... | |
int | strcmp (const char *str1, const char *str2) |
Function compares strings str1 and str2 and returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation). Accordingly, the result is greater than zero if str1 is greater than str2 and vice versa. More... | |
char * | strcpy (char *dest_ptr, const char *src_ptr) |
Function copies the string from src_ptr to the string dest_ptr. If copying is successful, the function returns dest_ptr. If copying takes place between objects that overlap, the behavior is undefined. More... | |
int | strlen (const char *str) |
Function returns the length of the string str. (the terminating null character does not count against string's length). More... | |
char * | strncat (char *dest_ptr, const char *src_ptr, int size) |
Function appends not more than size characters from the string src_ptr to dest_ptr. The initial character of src_ptr overwrites the null character at the end of dest_ptr. The terminating null character is always appended to the result. The function returns dest_ptr. More... | |
char * | strncpy (char *dest_ptr, const char *src_ptr, int size) |
Function copies the string from src_ptr the string dest_ptr. If copying is successful, the function returns dest_ptr. If copying takes place between objects that overlap, the behavior is undefined. More... | |
int | strspn (const char *str1, const char *str2) |
Function computes the length of the maximum initial segment of the string pointed to by str1 that consists entirely of characters that are in the string pointed to by str2. The function returns the length of the initial segment. More... | |
char | strcspn (const char *str1, const char *str2) |
Function computes the length of the maximum initial segment of the string pointed to by str1 that consists entirely of characters that are not in the string pointed to by str2. The function returns the length of the initial segment. More... | |
int | strncmp (const char *str1, const char *str2, char len) |
Function lexicographically compares not more than len characters (characters that follow the null character are not compared) from the string pointed by str1 to the string pointed by str2. More... | |
char * | strpbrk (const char *str1, const char *str2) |
Function searches str1 for the first occurrence of any character from the string str2. The terminating null character is not included in the search. The function returns pointer to the matching character in str1. If str1 contains no characters from str2, the function returns 0. More... | |
const char * | strrchr (const char *ptr, char chr) |
Function searches the string ptr for the last occurrence of character chr. The null character terminating ptr is not included in the search. The function returns pointer to the last chr found in ptr; if no matching character was found, function returns 0. More... | |
char * | strstr (const char *str1, const char *str2) |
Function locates the first occurrence of the string str2 in the string str1 (excluding the terminating null character). The function returns pointer to first occurrence of str2 in str1; if no string was found, function returns 0. If str2 is a null string, the function returns 0. More... | |
char * | strtok (char *str1, char *str2) |
The strtok function returns a pointer to the first character of a token, or a null pointer if there is no token. More... | |
void | str_cut_chr (char *str, char num) |
The str_cut_chr function removes all selected characters from string str, and returns it to the same str without those characters. More... | |
void | str_replace_chr (char *str, char chr_old, char chr_new) |
The replace_chr function replaces all chr_old characters in string str with chr_new characters and returns it to the same str. More... | |
void | str_cut_left (char *str, int num) |
The function str_cut_left crops string str to the left starting from position num. More... | |
void | str_cut_right (char *str, int num) |
The function str_cut_right crops string str to the right starting from position num. More... | |
void | str_split (char *str1, char *str2, int num) |
The str_split function splits string str1 into two strings, str1 and str2, after the num-th character. More... | |
void | str_insert_chr (char *str, char chr, int num) |
The str_insert_chr function adds selected character chr to string str at position num. More... | |
ANSI C String Library provides a set of standard ANSI C library functions useful for manipulating strings and RAM memory.
const void* memchr | ( | const void * | ptr, |
char | ch, | ||
unsigned int | num | ||
) |
Function locates the first occurrence of a character in a defined memory area starting with a given address. The function returns the pointer to this location or 0 if the n was not found.
[in] | ptr | Pointer to the address from which the character is searched from. |
[in] | ch | Character that is searched for. |
[in] | num | Number of bytes in memory from the start address where the search is conducted. |
int memcmp | ( | const void * | str1, |
const void * | str2, | ||
int | num | ||
) |
Function compares a given number of characters inside of objects pointed to by str1 and str2, returns zero if the objects are equal, or returns a difference between the first differing characters (in a left-to-right evaluation).
[in] | str1 | String object one. |
[in] | str2 | String object two. |
[in] | num | Number of characters compared. |
void* memcpy | ( | void * | dest_ptr, |
const void * | src_ptr, | ||
int | num | ||
) |
Function copies a given number of characters( num ) from the object pointed to by src_ptr into the object pointed to by dest_ptr. If copying takes place between objects that overlap, the behavior is undefined. The function returns address of the object pointed to by dest_ptr.
[out] | dest_ptr | Pointer to the location data is copied to. |
[in] | src_ptr | Pointer to the location data is copied from. |
[in] | num | Number of bytes of data to be copied. |
void* memmove | ( | void * | dest_ptr, |
const void * | src_ptr, | ||
int | num | ||
) |
Function copies num characters from a object pointed to by src_ptr into a object pointed to by dest_ptr. Unlike memcpy, the memory areas to and from may overlap. The function returns address of the object pointed to.
[out] | dest_ptr | Pointer to the location data is copied to |
[in] | src_ptr | Pointer to the location data is copied from |
[in] | num | Number of bytes of data to be moved. |
void* memset | ( | void * | ptr, |
char | chr, | ||
int | num | ||
) |
Function copies the value of the character into each of the first num characters of the object pointed by ptr. The function returns address of the object pointed to by ptr.
[in] | ptr | Pointer to the location from which the data will be set. |
[in] | chr | Value to which the data will be set. |
[in] | num | Number of bytes that will be set. |
char* strcat | ( | char * | dest_ptr, |
const char * | src_ptr | ||
) |
Function appends a copy of the string src_ptr to the string dest_ptr, overwriting the null character at the end of dest_ptr. Then, a terminating null character is added to the result. If copying takes place between objects that overlap, the behavior is undefined. The string must have enough space to store the result. The function returns address of the object pointed to by dest_ptr.
[out] | dest_ptr | Address of destination. |
[in] | src_ptr | Address of source. |
const char* strchr | ( | const char * | ptr, |
char | chr | ||
) |
Function locates the first occurrence of character chr in the string ptr. The function returns a pointer to the first occurrence of character chr, or a null pointer if chr does not occur in ptr. The terminating null character is considered to be a part of the string.
[in] | ptr | Address of string. |
[in] | chr | Character to search for. |
int strcmp | ( | const char * | str1, |
const char * | str2 | ||
) |
Function compares strings str1 and str2 and returns zero if the strings are equal, or returns a difference between the first differing characters (in a left-to-right evaluation). Accordingly, the result is greater than zero if str1 is greater than str2 and vice versa.
[in] | str1 | String 1. |
[in] | str2 | String 2. |
char* strcpy | ( | char * | dest_ptr, |
const char * | src_ptr | ||
) |
Function copies the string from src_ptr to the string dest_ptr. If copying is successful, the function returns dest_ptr. If copying takes place between objects that overlap, the behavior is undefined.
[out] | dest_ptr | Address of destination object. |
[in] | src_ptr | Address of source object. |
int strlen | ( | const char * | str | ) |
Function returns the length of the string str. (the terminating null character does not count against string's length).
[in] | str | String address. |
char* strncat | ( | char * | dest_ptr, |
const char * | src_ptr, | ||
int | size | ||
) |
Function appends not more than size characters from the string src_ptr to dest_ptr. The initial character of src_ptr overwrites the null character at the end of dest_ptr. The terminating null character is always appended to the result. The function returns dest_ptr.
[out] | dest_ptr | Address of destination object. |
[in] | src_ptr | Address of source object. |
[in] | size | Number of characters to append. |
char* strncpy | ( | char * | dest_ptr, |
const char * | src_ptr, | ||
int | size | ||
) |
Function copies the string from src_ptr the string dest_ptr. If copying is successful, the function returns dest_ptr. If copying takes place between objects that overlap, the behavior is undefined
[out] | dest_ptr | Address of destination object. |
[in] | src_ptr | Address of source object. |
[in] | size | Number of characters to copy. |
int strspn | ( | const char * | str1, |
const char * | str2 | ||
) |
Function computes the length of the maximum initial segment of the string pointed to by str1 that consists entirely of characters that are in the string pointed to by str2. The function returns the length of the initial segment.
[in] | str1 | Address of string 1. |
[in] | str2 | Address of string 2. |
char strcspn | ( | const char * | str1, |
const char * | str2 | ||
) |
Function computes the length of the maximum initial segment of the string pointed to by str1 that consists entirely of characters that are not in the string pointed to by str2. The function returns the length of the initial segment.
[in] | str1 | Address of string 1. |
[in] | str2 | Address of string 2. |
int strncmp | ( | const char * | str1, |
const char * | str2, | ||
char | len | ||
) |
Function lexicographically compares not more than len characters (characters that follow the null character are not compared) from the string pointed by str1 to the string pointed by str2.
[in] | str1 | Address of string 1. |
[in] | str2 | Address of string 2. |
[in] | len | Number of characters to compare. |
char* strpbrk | ( | const char * | str1, |
const char * | str2 | ||
) |
Function searches str1 for the first occurrence of any character from the string str2. The terminating null character is not included in the search. The function returns pointer to the matching character in str1. If str1 contains no characters from str2, the function returns 0.
[in] | str1 | Address of string 1. |
[in] | str2 | Address of string 2. |
const char* strrchr | ( | const char * | ptr, |
char | chr | ||
) |
Function searches the string ptr for the last occurrence of character chr. The null character terminating ptr is not included in the search. The function returns pointer to the last chr found in ptr; if no matching character was found, function returns 0.
[in] | ptr | Address of string to check. |
[in] | chr | Character to check for. |
char* strstr | ( | const char * | str1, |
const char * | str2 | ||
) |
Function locates the first occurrence of the string str2 in the string str1 (excluding the terminating null character). The function returns pointer to first occurrence of str2 in str1; if no string was found, function returns 0. If str2 is a null string, the function returns 0.
[in] | str1 | Address of string 1. |
[in] | str2 | Address of string 2. |
char* strtok | ( | char * | str1, |
char * | str2 | ||
) |
The strtok function returns a pointer to the first character of a token, or a null pointer if there is no token.
[in] | str1 | Address of string 1. |
[in] | str2 | Address of string 2. |
void str_cut_chr | ( | char * | str, |
char | num | ||
) |
The str_cut_chr function removes all selected characters from string str, and returns it to the same str without those characters.
[in] | str | Address of string. |
[in] | num | Character to cut. |
void str_replace_chr | ( | char * | str, |
char | chr_old, | ||
char | chr_new | ||
) |
The replace_chr function replaces all chr_old characters in string str with chr_new characters and returns it to the same str.
[in] | str | Address of string. |
[in] | chr_old | Character to be replaced. |
[in] | chr_new | Character to replace with. |
void str_cut_left | ( | char * | str, |
int | num | ||
) |
The function str_cut_left crops string str to the left starting from position num.
[in] | str | Address of string. |
[in] | num | Starting position. |
void str_cut_right | ( | char * | str, |
int | num | ||
) |
The function str_cut_right crops string str to the right starting from position num.
[in] | str | Address of string. |
[in] | num | Starting position. |
void str_split | ( | char * | str1, |
char * | str2, | ||
int | num | ||
) |
The str_split function splits string str1 into two strings, str1 and str2, after the num-th character
[in] | str1 | Address of string 1. |
[in] | str2 | Address of string 2. |
[in] | num | Position to be split at. |
void str_insert_chr | ( | char * | str, |
char | chr, | ||
int | num | ||
) |
The str_insert_chr function adds selected character chr to string str at position num.
[in] | str | Address of string. |
[in] | chr | Character to be added. |
[in] | num | Position to add at. |