Strlib:str-replace
From SA-MP Wiki
(Redirected from Strlib/str replace)
Description:
The function str_replace allows you to replace a string with another string in one huge string.
Warning | This function is part of the strlib library. Click here to view its download page on the SA-MP forums. |
(sSearch[], sReplace[], sSubject, &iCount)
sSearch[] | The string you want to remove. |
sReplace[] | The string you want to replace it with. |
sSubject[] | The string you want to replace it with. |
&iCount | Optional integer with the amount of times the string has been replaced. |
Return Values:
String that has been replaced.
Example
new sSearch[] = "red", // String you want to search for sReplace[] = "yellow", // String you want to replace it with sSubject[] = "The red lorry jumped over Red, the redneck from Nebraska."; print("%s", str_replace(sSearch, sReplace, sSubject));
Output
The yellow lorry jumped over Red, the yellowneck from Nebraska. (note it is case sensitive!)