This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Rob Rowan

+ Follow
since Nov 14, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rob Rowan

Thank you! This helps a lot! I'm new to java, learning it in university so the names of variables and arrays are just temp but I see why you mean about it having to be relevant. Ill try out what you said and get back to you. Big help thank you!
5 years ago
Yes I have and the problem lies with the duplicates.
Final array is the array where I store the 8 random characters generates by a previous bit of code. Test.txt is the dictionary and I'm storing It I'm an array in case I need to use it. I'm checking if the read line contains those 18 because I removed 8 out of 26 of the alphabet(the 8 random letters) if I search for just the 8 ransoms I get words that contain those letters but also other letters.
What I'm trying to do is if I get these 8 characters:
And search through the dictionary ill get football.
And not something that contains multiple Bs As or Fs
5 years ago
Thanks for helping me clean up the code, it was a bit messy but I'm still really stuck with this! Any help would be appreciated.
5 years ago
I am currently, on my mobile so it's taking a while. I apologise if I seemed lazy prior.
5 years ago
Will do in future, sorry about that!
5 years ago
Okay everyone, I made a thread on here earlier on ROUGHLY the same topic but not quite. I've gotten a little further so far and I REALLY need some help.
Basically, I have a randomly generated set of characters(8) ranging from A-Z.
Let's say for arguments sake I get the following characters; T C E E I S P W
I've managed to get Java to search through an english dictionary text file and return any words that contain these characters, the problem is I get duplicates of characters there isn't duplicates of.
i.e. I get words like Cesspipe(two S's even though there's only one in the generated characters. Also doesn't make use of the W or the T)
Peetweet(Uses 4 E's and doesn't use the C I or S)

I'm looking for a way to look for strings that are basically an ANAGRAM of the randomly generated character list.
So far my code looks like this

What this does is it takes the randomly generated characters and deletes them from a list of all the letters in the alphabet. Then runs that list through an if statement every time the reader reads a line. If the line contains one of the characters I don't want, it makes the line null. Then if the line isn't null, it'll print it out.

So far I'm getting prints of every word in the dictionary that is made up of only those characters but I'm getting weird duplicates as previously stated. I have NO idea how to handle this and would really appreciate a point in the right direction. Thank you for your time!
5 years ago
Thanks a lot for your reply! My problem is I actually have no idea HOW to do this. I'm just learning Java and I was wondering if there was some sort of function that allowed me to search a string for a certain character. Basically what I want to do is find the word in the text file that contains the most amount of chars out of the 8. If anyone could help me with a very BASIC method of how to do it, I could work out how to implement it myself.

Also about your two questions.
1) I was messing around with an Array list function and it imported that by itself.
2) Thanks a lot! That's much more neat.
5 years ago
Oh! I've never encountered that. Thanks for clearing that up! I'm new at this! Just came on here looking for help and looking if I can help anyone else.
5 years ago
Looks to me you're not using "{" after the if parameters. You're using "(" or "))" instead. Make sure you open a new block of code when you create an if statement.
5 years ago
Hello everyone, this is my first post here! Eager to perhaps help some people out as well as get help myself.
I'm confused with this problem. I have a program that generates 8 random chars from two arrays, one being an array of vowels the other being an array of consonants (exactly like countdown)
It then saves the generated chars in a separate array. I was wondering if it was possible to use these chars to search through an array of strings and remove any string that didn't contain some if not all chars.
If it's confusing let me know and I'll try and elaborate.

So far I have this;

I have created the part of the program that generates the chars, that part works perfectly and the chars can be printed or handled in any other way.
This is the part where I am converting a dictionary into an array and printing it. This was just testing it, I don't need to print it.

So if my coding is right. That saves each line as it comes in an array, position equal to the integer count with increases every time the while != null runs.
The thing I am having major issues with is searching the array of words for things that match the chars.
Like countdown.

Thank you if anyone can help, if not, thanks anyway!
5 years ago