String

S

shapper

Hello,

I have an array of strings:

Dim a As String() = New String() {"New York", "UK"}

And a string:

Dim b As String = "New York"

I want to check if b is contained in a. In this case it would return
true.

How can I do this?

Thanks,

Miguel
 
G

Guest

Howdy,

Dim a As String() = New String() {"New York", "UK"}
Dim b As String = "New York"

Dim exists As Boolean = _
System.Array.Exists(Of String)(a, _
New Predicate(Of String)(AddressOf b.Equals))

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

String and Class 3
Access datatable columns 1
How to declare a string? 3
Data type. Multi pair of values. How can I do this? 2
Give array values 4
Split 2
NameValueCollection ... 3
Use of class function 2

Top