iterate over a series of alphabetically increasing strings

Discussion in 'Ruby' started by Vellingiri Arul, Sep 19, 2007.

  1. Dear Friends,
    How could i do iterate over a series of alphabetically increasing
    strings.

    by
    Vellingiri.
     
    Vellingiri Arul, Sep 19, 2007
    #1
    1. Advertisements

  2. alphabetically_increasing_strings.each {|str| ...}

    Or did you want to know how to sort them?

    Cheers

    robert
     
    Robert Klemme, Sep 19, 2007
    #2
    1. Advertisements

  3. Yes,
    I want to sort them.
     
    Vellingiri Arul, Sep 19, 2007
    #3
  4. Then use Enumerable#sort
    Like: %w(bb aa cc).sort
    #=> ["aa", "bb", "cc"]


    HTH,
    Sebastian
     
    Sebastian Hungerecker, Sep 19, 2007
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.