Results 1 to 1 of 1
Thread: reversing Strings
Reversing a string is easy. One way is to read a string character by character in reverse order and concatenate it with a string - lets say reversedString.
Easy and efficient is to use reverse() method of StringBuffer.
String a = "French is a difficult language."; System.out.println("Original string: " + a); StringBuffer b = new StringBuffer(a).reverse(); System.out.println("Reversed string: " + b);
- By ravian in forum New To JavaReplies: 7Last Post: 10-08-2009, 07:26 PM
- By kaban in forum New To JavaReplies: 2Last Post: 12-09-2007, 10:04 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-03-2007, 10:44 AM
- By mew in forum New To JavaReplies: 4Last Post: 12-02-2007, 10:42 PM
- By toad in forum New To JavaReplies: 5Last Post: 11-07-2007, 10:13 AM