Replaces the occurrences of a string by the ones of another string.
StrReplace(str1, str2, str3)
Where:
str1
Is the string on which the replacements will be made, the strong string. This variable may be Character, VarChar or LongVarChar type.
str2
Is the string to be searched for and replaced. This variable may be Character or VarChar type.
str3
Is the string replacing the searched one. This variable may be Character or VarChar type.
Type Returned:
Character
Objects: Procedure, Transaction, Web Panel, Panel, Data Provider
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3), Apple, Android, Angular
The StrReplace function returns a string resulting from replacing all the occurrences of string &Str2, found in &Str1, by the string &Str3.
Notes:
- The replacement is simultaneously made. i.e.: when a replacing text is inserted, the inserted text does not take part in the following pattern searches.
- This function differentiates between capital letters and small letters; “a” is different from “A”.
&Source = “Test#of#the#StrReplace#function”
&Ret = StrReplace(&Source, “#”, “ “)
// Result: &Ret = “Test of the StrReplace function”
In this case, the &Ret variable will have the text above (it will be the result of replacing all the occurrences of the ‘#’ character in &Source by blank spaces).
Replace method
StrSearch function