Replace Method

Official Content

Allows replacing the occurrences of a string by the ones of another string.


str1.Replace(str2, str3)

Type Returned:

Is the string on which the replaces will be made, the strong string. This variable may be Char, VarChar or LongVarChar type.

Is the string to be searched for and replaced. This variable may be Char or VarChar type.

Is the string replacing the searched one. This variable may be Char or VarChar type.


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(“#”, " ")
// Result: &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). 


Objects:  Procedures, Transactions, Web PanelsWork Panels
Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

See Also

StrReplace function
StrSearch function

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.