uniStrReplace()
Replaces parts of a string with another string.
Synopsis
int uniStrReplace(string&source,stringsearch,string
replace);
Parameters
Parameter | Description |
---|---|
source | String to search in |
search | String to replace |
replace | Replacement string |
Return value
This function returns the number of replacements. If parameters are missing or incorrect, -1 is returned.
Errors
Missing or incorrect arguments
Description
Finds every occurrence of search in source and replaces it with the "replace" string. This modifies the source string.
Example
Replaces in the string "source" the part "один" by "два" . The string 21 ("двадцать один") -> 22 ("двадцать два").
main()
{
string
source="двадцать один";
DebugN("the original source:", source);
int i = uniStrReplace(source, "один", "два");
DebugN("uniStrReplace replaced letters:", i, " ", source);
}
Assignment
Strings
Availability
CTRL