|
-
Jan 9th, 2001, 10:47 PM
#1
Thread Starter
Registered User
Hello, I uses this code(See below) to search a string for words and replace them, but when i want to search for a " and replace that, VB gets mad at me, and tells me that thats wrong.... any onw know how i can fix this?
Code:
Public Function ReplaceAll(ByVal searchString As Variant, findString As Variant, replaceString As Variant) As String
Dim strLeft As String
Dim strRight As String
Dim iFoundPos As Integer
strRight = searchString
If findString <> "" Then
Do While InStr(strRight, findString) <> 0
iFoundPos = InStr(strRight, findString)
strLeft = strLeft & Left(strRight, iFoundPos - 1) & replaceString
strRight = Right(strRight, Len(strRight) - (iFoundPos - 1) - Len(findString))
Loop
End If
ReplaceAll = strLeft & strRight
End Function
-
Jan 9th, 2001, 10:55 PM
#2
Maybe this function will work? http://www.vbsquare.com/tips/tip252.html
What VB version are you using? If it's VB6, you can use the Replace function.
-
Jan 9th, 2001, 11:04 PM
#3
Thread Starter
Registered User
Thanks
Thanks for the help, it works, and you i use VB6 and i don't realy know why i don't use Replace
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|