Solved

VB.Net - How to Work With Array Contents

Posted on 2014-02-19
2
277 Views
Last Modified: 2014-02-19
Good Day Experts!

I am trying to figure out the best way to iterate through an Array, manipulate the data and then either save it in place or to a new Array.

I have parsed off the string of a Delete query after the Where.  So, for example I would have "Customer = '123' And Order = 'abc'"

Then I run the following code to split it apart on the And:
                    Dim ValueArray() As String
                    ValueArray = qryString.Split(":")

The Array contains:
                     Customer = '123'
                     Order = 'abc'  

I am intersted in stripping off all data before/including the = and getting rid of the single quotes leaving:
                      123
                      abc

I would then need the data back in the original array or a new one.

What is the best way you all can suggest to achieve this?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 39871059
Try something like:
        Dim qryString As String = "Customer = '123' And Order = 'abc'"
        Dim ValueArray() As String = qryString.Split("And")
        For i As Integer = 0 To ValueArray.Length - 1
            If ValueArray(i).IndexOf("=") <> -1 Then
                ValueArray(i) = ValueArray(i).Split("=")(1).Trim
            End If
            ValueArray(i) = ValueArray(i).Trim("'")
            Debug.Print(i & " = " & ValueArray(i))
        Next

Open in new window

0
 

Author Comment

by:Jimbo99999
ID: 39871596
Thanks for the help...it works great! I like the split on = I didn't think of that.
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question