[HELP] JAva reverse()
Moderator: wizme
[HELP] JAva reverse()
someone can help me in java? i using reverse method... how to reverse specific words in a sentences....??
Re: [HELP] JAva reverse()
by REVERSING words did u mean like changing
XEMECTRUM to MURTCEMEX
LOL
XEMECTRUM to MURTCEMEX
LOL
Re: [HELP] JAva reverse()
nope... example this sentences.." i love emectrum"
the output gonna be like this " i evol emectrum"
i only wanna reverse the "love" word...
the output gonna be like this " i evol emectrum"
i only wanna reverse the "love" word...
Re: [HELP] JAva reverse()
Hi, you need a function to reverse certain words in a sentence or whole sentence?
Normally for reversing we will use array, i'm not sure about java.
If you need to choose certain word to reverse in a sentence, try doing this:
Split the sentence by space into an array.
Ask user which word(which element in the array) he want to reverse.
Reverse it using "array[element index] = new StringBuffer(array[element index]).reverse().toString();"
Join back the array to get sentence.
Normally for reversing we will use array, i'm not sure about java.
If you need to choose certain word to reverse in a sentence, try doing this:
Split the sentence by space into an array.
Ask user which word(which element in the array) he want to reverse.
Reverse it using "array[element index] = new StringBuffer(array[element index]).reverse().toString();"
Join back the array to get sentence.
Unlike science, love is like magic, there's no reason to it - wizme =)
Learn more of security, click here =)
Learn more of security, click here =)
Re: [HELP] JAva reverse()
Btw thankx =D i have found others functionwizme wrote:Hi, you need a function to reverse certain words in a sentence or whole sentence?
Normally for reversing we will use array, i'm not sure about java.
If you need to choose certain word to reverse in a sentence, try doing this:
Split the sentence by space into an array.
Ask user which word(which element in the array) he want to reverse.
Reverse it using "array[element index] = new StringBuffer(array[element index]).reverse().toString();"
Join back the array to get sentence.
