str_replace_characters_with_string_c
num_escaped.i4.v = str_replace_characters_with_string_c(source_string.i1a.r,
length.i4.v,
chars_to_replac.i1a.r,
replace_string.i1a.r,
output_string.i1a.r,
max_length.i4.v
[,options.u4.v])
This routine replaces any of a set of characters in a string
with a corresponding string.
source_string source string
length length of source string (If a value of zero is passed,
the length of the string will be calculated.)
chars_to_replac null terminated set of characters to be replaced
replace_string null terminated replacement string
output_string returned null terminated string with escaped
quote characters (This argument can point to
the original string.)
max_length maximum length of the output string not including
the null terminator
[options] use options
(STR_OPT_NONE -> no options selected)
This function returns status values as follows:
CLIB_INVARG invalid quote character requested
CLIB_TRUNCATED output string was too long
otherwise number of characters escaped
This function requires the following include files:
cbslib_h, acnet_errors_h
Related functions:
str_replace_characters_with_strings_c, str_replace_character_set_c,
str_replace_char_set_c, str_replace_character_c, str_replace_char_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 source_string[LENGTH+1] = "It's Brian's $100.";
static const char chars_to_replace[] = "\'$";
static const char replace_string[] = "ESCAPE";
int num_replaced;
int length = 0;
int max_length = LENGTH;
int quote_string = FALSE;
unsigned int options = STR_OPT_NONE;
num_escaped = str_replace_characters_with_string_c(source_string,
length,
chars_to_replac,
replace_string,
source_string,
max_length,
options);