Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to ignore words after First Word

 
James Hannigan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12125
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"?
 
James Hannigan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
J. Kevin Robbins
Bartender
Posts: 1759
19
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic