I wish to loop through a dictionary file and find words that contain only the given characters
Example dgo
Desired results: dog, god
NOT words that contain (within them) the given characters
I am working with the following code:
while((dictionaryWord = br_.readLine()) != null)
{
if(dictionaryWord.contains(getWord()))
System.out.println(dictionaryWord);
}
But this gives me all words which contain the given characters -- NOT DESIRED
Without regular expressions:
UPDATE: better performing version (thanks to user384706):
You could check by doing