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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing one element of an array to another

Status
Not open for further replies.

tziviak

Technical User
Oct 10, 2002
128
US
I have an array and I'm trying to compare letter by letter to another array. the .equals accepts an object so in order to compare I'm trying to swith one element of the array to a string and then to compare it. I would appreciate if you can help me since I'm a beginner

my code:

String let;
let=new String (toString(letters));
if (bef[x].equals(let))
break;

how can I get it to compare bef[x] to letters

 
Does buf[x] contain an array of chars?

if let is a String, you can use let.toCharArray to return an arrar of chars, and then loop through this comparing agains each element in buf[].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top