This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Need to ignore words after First Word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need to ignore words after First Word" Watch "Need to ignore words after First Word" New topic
Author

Need to ignore words after First Word

James Hannigan
Greenhorn

Joined: Jan 16, 2013
Posts: 4
Hello everyone !

I am stuck in my project.
It seems easy but i am newbie and i can not handle it.

So, here is my question ;

My teacher give me a dictionary list like

ABRI a bomb shelter [n -S]
ABUT to touch along a border [v ABUTTED, ABUTTING, ABUTS]
ABYE to {aby=v} [v ABOUGHT, ABYING, ABYES]
ABYS <aby=v> [v]
ACED <ace=v> [v]
ACES <ace=v> [v]


i should skip the explanations of words. I should only get the first word and add it into an array.

secondly i should random a word and write hangman game but it is okay. My problem is about getting words from the list. Could anyone help me ?

Thanks to all !
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11444
    
  16

The first steps always involve turning off your computer. Stop thinking about writing a program. Start thinking about how you would tell a child to do this task.

Assume all the data is written on a piece of paper.

How would you tell the child to identify the "first word"?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
James Hannigan
Greenhorn

Joined: Jan 16, 2013
Posts: 4
Probably i will give him a scissor and show where he should cut the paper or , oh, i am not good at communicate with childs i dont know man.
or i can let him know he should not take after first whitespace ?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3720
    
  16
god likeme wrote:i can let him know he should not take after first whitespace ?

That sounds good. So now all you need to do is work out how to do that in Java.


Joanne
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 1003
    
  13

I'll give you another clue since you seem to be struggling. Look at the api docs for the String class and read about the indexOf() method. Does that give you any ideas on how you could find that space?


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need to ignore words after First Word