• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

isolate words in strings, change characters

 
Nick Allen
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am a complete idiot with programming. i have an assignment due tomorrow.
it has to take a simple user input, print out the length of the input, the length of the first and last words (causing me the most trouble). then switch some characters around several times and print each new text
 
Torsten Schippel
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nick,
shall we do your work? I would recommend a StringBuffer.
Regards
Torsten
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you read the user input into a String then you can use one of the methods of String to find the length.
You can use another method of String to find the first space (everything before it would be the first word) and the last space (everything after it would be the last word).
You can also achieve similar results by reading the user input into an array of chars and then using a for loop to find the spaces.
If you get some code together, post it here and maybe we can help you get through this.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am moving this to "Java in General (beginners)".
 
Missus Norah
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing about the same assignment as Nick Allen only I have to produce four files- ServerModel, ClientModel, ServerView and ClientView.
Here is my
can someone help me?!? thanks so much...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic