..im just wondering...If I have entered a sentence in a InputDialog box, using JOptionPane, how can I get the middle character per word and put it at the beginning of each word then add a "java" word at the end of each word..?..

for example:

The girl jumped

The result should be like this:

hTejava igrljava mjupedjava


..I have tried using the charAt method..but it only gets the middle character of the FIRST word..but if there could be a way I can use the charAt method to attain my objective..could you please show me how..??

..Thank you..

Recommended Answers

All 4 Replies

First split the String into words (see the split(...) method in String class), process each word using charAt etc, the put all the words back together into a sentence.

..Actually I already used to depart the input sentence by using substring()..will it work as well as using split()?..

..by the way thanks for idea..I'll try it..

Split is usually the easiest way to split a sentence into an array of words - try it and see what you think!

...Thank you so much..

..my question has been solved..thanks for the sentence.split() idea...it really make sense now..

..unfortunately..it takes me DAYS before i could finally understand it..

..but anyways...im really thankful...GOD BLESS...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.