?
Solved

VB.Net - How to Work With Array Contents

Posted on 2014-02-19
2
Medium Priority
?
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

762 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