-
Nov 7th, 1999, 01:20 AM
#1
If you are using vb6 you can use the Replace function. eg
strWords = Replace(strWords, "basic", "")
otherwise you need to use Instr in a loop to replace the word.
-
Nov 7th, 1999, 12:58 PM
#2
Hyperactive Member
Hi,
I have a string called strWords and would like to click a button called cmdGo and have that button look inside the string for the word Basic and if it is found, Remove it. Will someBody please help?
Thanks
-
Nov 9th, 1999, 05:04 AM
#3
New Member
You could write your own function in a module such as:
code
-------------------------------------------
Public Function RemoveStr(BaseStr As String, StrToRemove As String) As String
Dim sTemp As String
On Error GoTo ErrHandler
'This ugly statement cuts the StrToRemove out of BaseStr
sTemp = Left(BaseStr, InStr(BaseStr, StrToRemove) - 1) & _
Mid(BaseStr, InStr(BaseStr, StrToRemove) + Len(StrToRemove), _
Len(BaseStr) - InStr(BaseStr, StrToRemove) + Len(StrToRemove))
RemoveStr = sTemp
Exit Function
ErrHandler:
RemoveStr = ""
Exit Function
End Function
-------------------------------------------
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
|