The documentation I've scoured fails to tell me if there is an equivalent to the classic VB function, "Replace()". There is a "Replace()" method of the String object, but it only accepts Chars as parameters, thus producing an error when I try something like this:<BR><BR>*************************************<BR>sString.Replace("X", "Some String")<BR>*************************************<BR><BR>Does anyone know of a method that works the same way as the old "Replace()" function? Or maybe a work-around?<BR><BR>I know that I can include the statement, "Imports Microsoft.VisualBasic.Compatibility.VB6" for backward compatibility, but I really don't want to have to rely on looking backwards.<BR><BR>Thank you,<BR><BR> ~~ TonyCheck out the Replace function in the StringBuilder class<BR>http://msdn.microsoft.com/library/dotnet/cpref/frlrfsystemtextstringbuilderclassreplacetopic1.htmThanks Scott - I just figured that out. I'm doing something like this:<BR><BR>********************************<BR>dim sString as String<BR>dim oSB as StringBuilder<BR><BR>sString = "This is a test."<BR>oSB = new StringBuilder(sString)<BR>sString = oSB.Replace("a", "a stupid").ToString()<BR><BR>'The resulting string is: "This is a stupid test."<BR>********************************<BR><BR>But if you know of a better way, I'd be happy to hear it.<BR><BR>Thanks again,<BR><BR>~~ TonyHey Tony<BR><BR>I'm not at my development computer right now so I can't verify this, but I believe the Replace method also has a static version:<BR><BR>Dim s as String = "This is a test"<BR>Dim stupid as String = StringBuilder.Replace(s, "a", "a stupid")<BR><BR>(Notice that the static method version does not create an instance of the StringBuilder class, and uses the more familiar parameter calling (stringToReplace, stringToSearchFor, replacementString)<BR><BR>Happy Programming!Thanks! I'll try that out!<BR><BR>~~ TonyI don't think it works - I couldn't get it to anyway. I'll tweak it around a little and try some different ways of doing it.Just checked out the docs, and you're right, there is no static method. Don't worry, Beta2 will have a Replace method in the String class that will work with strings.... Beta2 should be publically available by June 17th.<BR><BR>So, for now, you're going to have to use the StringBuilder method (or via Regular Expressions), but eventually (in a month or so) you will be able to do it the more natural way.<BR><BR>Happy Programming!