java - store each string in sentence in reverse way -
i try buffered string.reverse(); want reverse each word of sentence. try this..
for(int = 0;a <= msglength; a++){ temp += msg.charat(a); if((msg.charat(a) == '')||(a == msglength)){ for(int b = temp.length()-1; b >= 0; b--){ encrypt_msg += temp.charat(a); if((b == 0) && (a != msglength)) encrypt_msg += ""; } temp = ""; } }
plz me simplify logic. string user defined. wanted print reversed string in jtextfields.
try following simple code:
string sentence= "this sentence"; string[] words=sentence.split(" "); for(string word: words){ system.out.println(new stringbuilder(word).reverse()); }
Comments
Post a Comment