translate_string()
#
translate_string
replaces characters in the from
string with corresponding characters from the mk_to
string, based on the mapping defined in mk_from
.
Prototype
char *translate_string(
char *to,
int tolen,
const char *from,
const char *mk_to,
const char *mk_from
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Buffer to store the translated string. |
|
|
Size of the |
|
|
Input string containing characters to be replaced. |
|
|
String containing replacement characters. |
|
|
String containing characters to be replaced. |
Return Value
Returns a pointer to the to
buffer containing the translated string.
Notes
[‘The mk_from
and mk_to
strings define a mapping where each character in mk_from
is replaced by the corresponding character in mk_to
.’, ‘If tolen
is too small, the function may not fully translate the input.’, ‘The function does not allocate memory; the caller must ensure to
has sufficient space.’]
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples