![]() |
Spliting and adding - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: Spliting and adding (/Thread-Spliting-and-adding) |
Spliting and adding - 1llusion - 02-09-2011 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") 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? ![]() Code: result = New DataTable().Compute(arrText(1) & x & arrText(2)......, Nothing) Thank you very much!!! Have a great day!!! RE: Spliting and adding - Coder-san - 02-09-2011 UBound(arrText) or arrText.GetUpperBound(0) should do it. I'm not sure what you want to make though. RE: Spliting and adding - 1llusion - 02-09-2011 (02-09-2011, 04:55 PM)Coder-san Wrote: UBound(arrText) or arrText.GetUpperBound(0) should do it. 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) ![]() Thanks! RE: Spliting and adding - Coder-san - 02-09-2011 Code: For i As Integer = 0 To UBound(arrText) This should work. I don't have compiler here at the moment to check. RE: Spliting and adding - 1llusion - 02-09-2011 (02-09-2011, 05:30 PM)Coder-san Wrote: Thanks ![]() ![]() Well... time to teach my program that 1 + x = 5 /// x = 1002 is wrong answer.... |