Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


Spliting and adding filter_list
Author
Message
Spliting and adding #1
Hi :epic:

Well... I'm doing final stage of my Math Bruteforcer and I found a little problem:

I split the math problem, so I can add some variables. Well I do this:

Code:
arrText = TextBox1.Text.Split("x")
Now, I need to add "x" variables between each split.

Problem is, I don't know how many parts there will be, so I will somehow have to loop through all parts and add all x'es...

Any idea please? Smile
Code:
result = New DataTable().Compute(arrText(1) & x & arrText(2)......, Nothing)

Thank you very much!!! Have a great day!!!
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply

RE: Spliting and adding #2
UBound(arrText) or arrText.GetUpperBound(0) should do it.

I'm not sure what you want to make though.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: Spliting and adding #3
(02-09-2011, 04:55 PM)Coder-san Wrote: UBound(arrText) or arrText.GetUpperBound(0) should do it.

I'm not sure what you want to make though.

I thought of this, but i'm not sure if it helps...

well... I want the app to add: & x
to all arrText parts.

So in the end it would be:
Code:
arrText(1)  & x  & arrText(2) & x  & arrText(3)
but instead of this, I'm looking for code that does this for any number of arrays Smile

Thanks!
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply

RE: Spliting and adding #4
Code:
For i As Integer = 0 To UBound(arrText)
      MathStr &= arrText(i) & If(i < UBound(arrText),"" ,"x")
Next
result = New DataTable().Compute(MathStr, Nothing)

This should work. I don't have compiler here at the moment to check.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: Spliting and adding #5
(02-09-2011, 05:30 PM)Coder-san Wrote:
Code:
For i As Integer = 0 To UBound(arrText)
      MathStr &= arrText(i) & If(i < UBound(arrText),"" ,"x")
Next
result = New DataTable().Compute(MathStr, Nothing)

This should work. I don't have compiler here at the moment to check.

Thanks Smile works perfect Smile

Well... time to teach my program that 1 + x = 5 /// x = 1002 is wrong answer....
Staff will never ever ask you for your personal information.
We know everything about you anyway.

Reply







Users browsing this thread: 1 Guest(s)