|
-
Oct 16th, 2008, 12:12 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] is There a Function That do this ?
Hi ,
The Split Function has as parameter char
is there a way to use Split Function With String as parameter
How ?
let's say i have this string :
" Hello Vb Forum members enjoy your stay at VbForums enjoy"
i need to extract the String between enjoy
it should be : "your stay at VbForums"
Split("enjoy")..
Thanks
-
Oct 16th, 2008, 12:19 PM
#2
Re: [2005] is There a Function That do this ?
You can use Regex for that:
VB.NET Code:
Dim myString As String = "The quick fox jumped over the lazy fox"
Dim reg As New System.Text.RegularExpressions.Regex("fox")
Dim mySplittedString() As String = reg.Split(myString)
-
Oct 16th, 2008, 12:22 PM
#3
Lively Member
Re: [2005] is There a Function That do this ?
strToSplit = Mid(strToSplit, 0, Int(strToSplit.Length / 2))
i think that works ....
-
Oct 16th, 2008, 12:24 PM
#4
Re: [2005] is There a Function That do this ?
As atheist said, although you don't even need to create an instance of regex, there is a shared split method.
Code:
Dim myString As String = "The quick fox jumped over the lazy fox"
Dim mySplittedString() As String = System.Text.RegularExpressions.Regex.Split(myString,"fox")
-
Oct 16th, 2008, 12:28 PM
#5
Thread Starter
Fanatic Member
Re: [2005] is There a Function That do this ?
 Originally Posted by Atheist
You can use Regex for that:
VB.NET Code:
Dim myString As String = "The quick fox jumped over the lazy fox" Dim reg As New System.Text.RegularExpressions.Regex("fox") Dim mySplittedString() As String = reg.Split(myString)
Thanks Atheist work Great 
Yes kleinma work too
@tylerpestell
strToSplit = Mid(strToSplit, 0, Int(strToSplit.Length / 2))
i dont know what you mean ?
anyway now it's working
Thanks All
-
Oct 16th, 2008, 06:00 PM
#6
Re: [RESOLVED] [2005] is There a Function That do this ?
you can split a string With String as parameter:
Dim myString() As String = "The quick fox jumped over the lazy fox".Split(New String() {"fox"}, StringSplitOptions.RemoveEmptyEntries)
Last edited by .paul.; Oct 16th, 2008 at 06:34 PM.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
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
|