Replace text

  • Thread starter Thread starter Richard Grene
  • Start date Start date
R

Richard Grene

What's the best way to replace all occurances of chars within a string with
another string? Example: Replace all $ within abcd$efg with &% so that the
new string is abcd&%efg.


Thanks,
Richard
 
Hello,

Richard Grene said:
What's the best way to replace all occurances of chars
within a string with another string? Example: Replace all $
within abcd$efg with &% so that the new string is abcd&%efg.

Have a look at the 'Microsoft.VisualBasic.Strings.Replace' method.
 
You could use RegX But for this ill refer to the outdated
Replace function ala
Replace("my:String", ":", ".") Rem// = "my.String"
 
Richard Grene said:
What's the best way to replace all occurances of chars within a
string with another string? Example: Replace all $ within abcd$efg
with &% so that the new string is abcd&%efg.

Why not use the string's replace method?

dim s as string = "abcd$efg"
s = s.replace("$", "&%")
 
Back
Top