Str_Char_Replace_N()
Search string for specific character and replace it by another specific character, up to a maximum number of characters.
Files
lib_str.h/lib_str.c
Prototype
CPU_CHAR *Str_Char_Replace_N (CPU_CHAR *pstr, CPU_CHAR char_srch, CPU_CHAR char_replace, CPU_SIZE_T len_max);
Arguments
pstr
Pointer to the string to search for the specified character.
char_srch
Character to search for in the string.
char_replace
Replacement character.
len_max
Maximum number of character to search for.
Returned Value
Pointer to string, if no errors;
Pointer to NULL
, otherwise.
Required Configuration
None.
Notes / Warnings
String buffer not modified.
String search terminates if string pointer points to or overlaps the NULL
address, or if len_max
has been reached.
Example Usage
CPU_CHAR *pstr; pstr = Str_Char_Replace_N("HellY World!", 'Y', 'o', 13);