Results 1 to 2 of 2
  1. #1
    aquafoam is offline Member
    Join Date
    Apr 2010
    Rep Power

    Default StringList character rotation

    Please please help! I would appreciate it so much :) Sorry if I am posting in the wrong place, I just started... :)

    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));
    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...

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Rep Power


    Don't cross post.

    This is hardly and "advanced" question and you already posted a question in the "New to Java" forum 10 minutes earlier.

Similar Threads

  1. StringList rotation
    By aquafoam in forum New To Java
    Replies: 1
    Last Post: 04-20-2010, 09:02 AM
  2. Read from a certain character to a certain character
    By blackstormattack in forum New To Java
    Replies: 0
    Last Post: 03-16-2009, 12:36 PM
  3. Need help with 2d Array rotation!
    By TrungTran in forum Advanced Java
    Replies: 1
    Last Post: 11-23-2008, 06:35 AM
  4. Log rotation in ubuntu
    By sarah11 in forum New To Java
    Replies: 0
    Last Post: 11-04-2008, 08:46 AM
  5. reading text character by character
    By bugger in forum New To Java
    Replies: 2
    Last Post: 11-09-2007, 09:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts