|
-
Jun 3rd, 2005, 05:06 PM
#1
Thread Starter
Admodistrator
Removing something inbetween two strings
Okay, say text box1 is like this:
Code:
Create Animated Emoticons in Your Chats! Get MSN Messenger.
Audi S4
View Pictures, Specs & Detailed Info about the 2005 Audi S4
Find a Birth Month & Year
Over 100 Million Birthdays Search by Name. Free Search.
Clan/Guild Skins
Custom and pre-made skins available with an easy to use portal design
(an example)
and lets say i wanted to replace everything except these two parts...without splitting by vbcrlf:
Code:
Create Animated Emoticons in Your Chats! Get MSN Messenger.
Audi S4
View Pictures, Specs & Detailed Info about the 2005 Audi S4
i know its mid, but how do i find the letters number?example would be nice
-
Jun 3rd, 2005, 05:20 PM
#2
Re: Removing something inbetween two strings
Mid$ with InStr :
VB Code:
Dim iPos As Integer
iPos = InStr(1, Text1.Text, "Find a Birth Month & Year")
MsgBox Mid$(Text1.Text, 1, iPos - 1)
Has someone helped you? Then you can Rate their helpful post. 
-
Jun 4th, 2005, 04:14 AM
#3
Re: Removing something inbetween two strings
This function removes everything from OriginalString between String1 & String2
VB Code:
Function RemoveX(ByVal OriginalString As String, ByVal String1 As String, String2 As String) As String
Dim i As Long, j As Long
i = InStr(OriginalString, String1) + Len(String1)
RemoveX = Left(OriginalString, i)
i = InStr(i, OriginalString, String2)
RemoveX = RemoveX & Mid(OriginalString, i)
End Function
Private Sub Command2_Click()
''Use it like this
MsgBox RemoveX("That was a very good example", "was", "good")
End Sub
-
Jun 4th, 2005, 07:46 AM
#4
Addicted Member
Re: Removing something inbetween two strings
well.. if u knw wat the exact string is u can also use replace function like...
Replace("That was a very good example","That was","")
it replaces it with a blank string.. equivalent to removing it
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
|