Results 1 to 2 of 2
Thread: StringList rotation
- 04-20-2010, 05:06 AM #1
Member
- Join Date
- Apr 2010
- Posts
- 2
- Rep Power
- 0
StringList character rotation
Please please help! I would appreciate it so much :)
I'm trying to get a StringList of all the rotations for a given string, such as abcd
ie. abcd -> bcda -> cdab -> dabc
but I only seem to be able to get one with my code
public static String iterations(String s) {
StringBuffer iteration = new StringBuffer(butFirst(s));
iteration.append(first(s));
return iteration.toString();
}
the two methods
first(s) gives the first letter of the string, ie. a of abcd
butFirst(s) gives the rest of the string, ie. bcd of abcd
could someone please help me get a list of all the rotations? I tried using a for loop but it doesn't seem to work...Last edited by aquafoam; 04-20-2010 at 05:12 AM.
- 04-20-2010, 08:02 AM #2
Similar Threads
-
Image Rotation
By mix99 in forum AWT / SwingReplies: 1Last Post: 02-24-2010, 10:25 AM -
Need help with 2d Array rotation!
By TrungTran in forum Advanced JavaReplies: 1Last Post: 11-23-2008, 05:35 AM -
Log rotation in ubuntu
By sarah11 in forum New To JavaReplies: 0Last Post: 11-04-2008, 07:46 AM -
Rotation in java 3D
By émilie- in forum Java AppletsReplies: 0Last Post: 02-13-2008, 10:37 AM -
affineTransform rotation
By MichYer in forum AWT / SwingReplies: 0Last Post: 07-18-2007, 08:55 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks