Home > How-To Library > String Manipulation
How to use Replace function for VB5
**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * **************************************************************** 'If you are using VB5 and need Replace function that's available only in VB6, 'here is my version of it. Please let me know what you think. Function fnReplace(ByVal InWhat As String, What As String, WithWhat As String) As String Dim Pos As Long Pos = InStr(InWhat, What) While Pos fnReplace = fnReplace & Left(InWhat, Pos - 1) & WithWhat InWhat = Right(InWhat, Len(InWhat) - Pos - Len(What) + 1) Pos = InStr(InWhat, What) Wend fnReplace = fnReplace & InWhat End Function
If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.