Results 1 to 3 of 3
- 02-10-2011, 04:31 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 1
- Rep Power
- 0
- 02-10-2011, 04:39 AM #2
Use the methods of the String class but remember String is immutable so you need to create a new String all the time.
Or you can use StringBuilder or StringBuffer classes which are basically mutable Strings and have mostly the same methods that String has.
- 02-10-2011, 05:10 AM #3
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
Another way would be to look at the String methods for one that gives you an array of characters. (And for a suitable constructor so you can get a String back when you have finished working on the array).
Working along the array and swapping the characters is something that suggests using a for loop.
Similar Threads
-
Removing last character from a String
By newToJava3 in forum New To JavaReplies: 2Last Post: 11-28-2010, 12:43 AM -
compare String to the character .
By Bulelakes in forum JDBCReplies: 12Last Post: 07-28-2010, 11:35 AM -
Taking a character off the end of a string.
By AJArmstron@aol.com in forum New To JavaReplies: 5Last Post: 05-05-2010, 02:56 AM -
how to get next character/string
By doha786 in forum New To JavaReplies: 3Last Post: 03-28-2009, 04:04 AM -
How to store property file into key value pair
By Java Tip in forum java.utilReplies: 0Last Post: 04-05-2008, 10:16 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks