File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes isolate words in strings, change characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "isolate words in strings, change characters" Watch "isolate words in strings, change characters" New topic
Author

isolate words in strings, change characters

Nick Allen
Ranch Hand

Joined: Sep 25, 2003
Posts: 47
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


'I need something good to die for, to make it beautiful to live' -QSA
Torsten Schippel
Ranch Hand

Joined: May 09, 2003
Posts: 62
Hi Nick,
shall we do your work? I would recommend a StringBuffer.
Regards
Torsten
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
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.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I am moving this to "Java in General (beginners)".
Missus Norah
Greenhorn

Joined: Sep 30, 2003
Posts: 1
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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: isolate words in strings, change characters