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
Joined: May 09, 2003
Hi Nick, shall we do your work? I would recommend a StringBuffer. Regards Torsten
Joined: May 05, 2000
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.