vijay

welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Wednesday, February 23, 2011

Search a Items in Array() String without using any Loop


Introduction:

hi..
i got an requirement to search a value in an array,Normally i knew the concept of using for loop ,we can serach the items in array,but now i found new method without using any loop ,Its easy to find a items in arrray.


Description:
                    For an examble in an array it contains more than 50 items in array,Now our requirement is search one item in that array list,Normally we use for loop,But considering the time factor we can use another method to follow to find.....

Examble:  item(0)="people"
item(1)="chair"
'
'
item(10)="raj"
In that item of array list contains 10 value from that value we are going to find the value of "raj"
Code:
Dim lst as list(of string)
lst.addrange(item)
Dim result as string =lst.contains("raj")

The result has return a boolean value,if the result has True-"it array contains that value" otherwise it return "false"

i hope this one useful to you.....

0 comments:

Post a Comment