The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
How #ruby-lang approximates the corporate environment

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ryan Davis

Posts: 651
Nickname: zenspider
Registered: Oct, 2004

Ryan Davis is a ruby nerd.
How #ruby-lang approximates the corporate environment Posted: May 6, 2006 4:11 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Ryan Davis.
Original Post: How #ruby-lang approximates the corporate environment
Feed Title: Polishing Ruby
Feed URL: http://blog.zenspider.com/index.rdf
Feed Description: Musings on Ruby and the Ruby Community...
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Ryan Davis
Latest Posts From Polishing Ruby

Advertisement

Original Request:

I'd like to sort an array of strings numerically...

Modifications:

... but that doesn't handle letters (non-number strings)
... mine was shorter, but it uses an intermediate variable
... nice, but how do you get the digits before the letters?

My final version:

%w(z A 1 10 2 b).sort_by { |s| [ s[0], s.to_i, o ] }

(ugh)

Read: How #ruby-lang approximates the corporate environment

Topic: ¿Un Java Open Source cortesía del nuevo CEO de Sun Jonathan Schwartz? Previous Topic   Next Topic Topic: Coordinate Systems - Putting Everything Together

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use