string_replace
This function searches and replaces a specific text within a string and returns the result.
string string_replace(string the_string, string the_search, string replacement, bool replace_all)
Parameters:
the_string
The string that will be processed.
the_search
The text to search for within the string.
replacement
The string that will replace an occurrence of the search string.
replace_all
A boolean flag indicating whether every occurrence of the search should be replaced. If set to false, only the first occurrence is replaced.
Return value:
A new string containing any specified replacements. If no characters were replaced, or the search string was blank, the original string is returned. If the main text string is blank, a blank string is returned.
Remarks:
If the replacement string is blank, this has the effect of removing the search text from the string.
The search is case sensitive, meaning that Name is different from name, for instance.
Example:

    void main()
    {
    alert("string_replace test", "string_replace="+string_replace("Hello, I am a strange string!", "string", "strange", true)); //output should be Hello, I am a strange strange!
    }