str_replace_character_c
num_replaced.i4.v = str_replace_character_c(string.i1a.r, length.i4.v,
char_to_replace.i1.v,
replace_char.i1.v,
options.u4.v)
This routine replaces every occurrence of a specified character in
a string with another character.
string string to perform character replacements in
length length of string (If a value of zero is passed,
the length of the string will be calculated.)
char_to_replace character to be replaced
replace_char replacement character
options use options
(STR_OPT_NONE -> no options selected,
STR_OPT_HANDLE_QUOTES -> preserve characters in
quoted substrings,
STR_OPT_FIRST_ONLY -> only replace the first
matching character)
This function returns status values as follows:
number of characters replaced
This function requires the following include files:
cbslib_h
Related functions:
str_replace_char_c, str_replace_character_set_c,
str_replace_characters_with_string_c,
str_replace_characters_with_strings_c, str_replace_char_set_c,
str_translate_characters_c, str_remove_char_set_c, str_find_character_c,
str_find_character_set_c, str_replace_string_c, str_replace_bracketed_c,
str_find_string_c, str_find_last_string_c, str_character_count_c,
str_expand_tabs_c, str_make_printable_c,
str_find_not_in_character_set_c
C/C++ usage:
static char string[] = "string";
char char_to_replace = 's';
char replace_char = 'S';
int num_replaced;
int length = 0;
unsigned int options = STR_OPT_NONE;
num_replaced = str_replace_character_c(string,length,char_to_replace,
replace_char,options);