Replaces the occurrences of a string by the ones of another string.
Is the attribute or variable on which the replacements will be made. It must be based on the Character, VarChar or LongVarChar data type.
Is the string to be searched for and replaced. It must be an attribute, variable or fixed value based on the Character or VarChar data type.
Is the string replacing the searched one. It must be an attribute, variable or fixed value based on the Character or VarChar data type.
Data Types: Character, VarChar, LongVarChar
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)
The Replace method returns a string resulting from replacing all the occurrences of string Str2, found in Str1, by the string Str3.
- 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 method differentiates between capital letters and small letters; “a” is different from “A”.
&Source = “Test#of#the#Replace#method”
&Ret = &Source.Replace(“#”, " ") //&Ret = “Test of the Replace method”
In this case, the &Ret variable would have the following text (it would be the result of replacing all the occurrences of the ‘#’ character in &Source by blank spaces).