- StringAdd
- StringBufferLen
- StringCompare
- StringConcatenate
- StringFill
- StringFind
- StringGetCharacter
- StringInit
- StringLen
- StringSetLength
- StringReplace
- StringReserve
- StringSetCharacter
- StringSplit
- StringSubstr
- StringToLower
- StringToUpper
- StringTrimLeft
- StringTrimRight
StringReplace
It replaces all the found substrings of a string by a set sequence of symbols.
int StringReplace(
|
Parameters
str
[in][out] The string in which you are going to replace substrings.
find
[in] The desired substring to replace.
replacement
[in] The string that will be inserted instead of the found one.
Return Value
The function returns the number of replacements in case of success, otherwise -1. To get an error code call the GetLastError() function.
Note
If the function has run successfully but no replacements have been made (the substring to replace was not found), it returns 0.
The error can result from incorrect str or find parameters (empty or non-initialized string, see StringInit() ). Besides, the error occurs if there is not enough memory to complete the replacement.
Example:
string text="The quick brown fox jumped over the lazy dog.";
|
See also