Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Vector

Status
Not open for further replies.

timmbo

Programmer
Feb 22, 2001
167
US
Hi All,

Attempting to search a vector for an occurance of an account number. I have an account stored to my variable acct. Can someone show me how to search a vector for a specified item?

Code:
for(int k = 0; sortDebitRec.size() > k; k++) {
   System.out.println("HERE 2  " + acct);
   ****Attempting the search here....
   if(sortDebitRec.contains(acct)) { 
      System.out.println("HERE 3");
   }
}

Any help here would be most appreciate.

TIA,
Tim
 
Actually, the loop is unnecessary. Simply say

if(sortDebitRec.contains(acct))
{
System.out.println("Found it");
}

This will search the entire vector for that account number.
 
Thank you for the reply. I was pounding my head against the desktop trying to figure this out.

T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top