[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
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)
Re: [2005] is There a Function That do this ?
strToSplit = Mid(strToSplit, 0, Int(strToSplit.Length / 2))
i think that works ....
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")
Re: [2005] is There a Function That do this ?
Quote:
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
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)