How do I compare between the array of char and array of words !!?
hi guys:cool:
I have a file by a group of words stored in the array , also array of char.
I want array comparing the letters with the word like it, and return the right word .
Note: array of char may be some fields are empty.
for example: char[]={' ','r',' ','e'}
the word it will be ==tree
can you help?
Re: How do I compare between the array of char and array of words !!?
I'm not sure what you are trying to do.
What would be the results of comparing:
char[] someChars = {' ','r',' ','e'};
with
String str = "tree";
Are you looking for words that are 4 chars long and have r in 2nd and and e in 4th position?
Use a loop and one of the String class's methods to get the char one by one
or put the String into a StringBuffer and do it.