im searching a textbox for a string using 2 arguments. i will be getting more then one of each.
the arguments are [ and ].
for example:
the quick brown [fox] jumps over the lazy [dog].
i want to be able to get [fox] and [dog] using the arguments. i do not want to use arrays because it will be to slow.
so my output will be [fox] and then it will be [dog].
i searched the net for something like this but nothing helped.
thanks.

How to get a string between 2 arguments.
vbgeek3
thanks.
i can do this in vb6 but .net is diffrent and same in some ways.
what i do is find the first char and store its number then start from that number and find the other and toda i have the string but my main problem is doing it over and over and over again.
sorry for the misunderstanding and thanks again for the idea.
wd95014
glad I could help. . .
cheers!
J_Dude2003
Maybe I'm misunderstanding this; but I think that the only way some sort of array could be avoided would be if you could store the values you want outside of the textbox as they are entered.
In the "Change" event, get the last character and use that to either skip or store based on whether a bracket was entered.
rr12
ac506in
Here's an alernate approach:
Dim S As String = "The quick brown [fox] jumped over the lazy brown [dog]." Dim Cnt As IntegerCnt = S.IndexOf("[")
Do While Cnt > -1 Dim Ending As Integer = S.IndexOf("]", Cnt + 1) Dim Word As String = S.Substring(Cnt, Ending - Cnt + 1)MsgBox(Word)
Cnt = S.IndexOf("[", Ending)
Loop- Kristian -
Thank you so much!
im still reading it to understand it more and thought arrays would take longer then my plan but it works great for my project.
im starting to understand that Exceptions are the new error trapper type deal. its a bit hard to understand but the more i read the more easly it is to understand.
i dont know how many times to thank you for your help but its alot.
if i could help you with anything at all, send me a msg on msn.
Cathan
I am sure there is some way to do this with regex's but they confuse the hell out of me. . .
and there is probably more than one way to beat this child, too:
Dim s As String = "the quick brown [fox] jumps over the lazy [dog]."
Dim ss() As String = s.Split("[")
Dim al As New List(Of String)(ss)
al.RemoveAt(0)
Dim al2 As New List(Of String)()
For Each s In al
ss = s.Split("]")
If ss.Length <> 2 Then Throw New Exception("Unmatched Bracket")
al2.Add(ss(0))
Next
For i As Integer = 0 To al2.Count - 1
al2(i) = "[" + al2(i) + "]"
Next
For Each s In al2
Console.WriteLine(s)
Next