Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Column sort (Noobie question
Pablo Tejada
9/4/2006 1:40:00 PM
I am write a program to sort pictures, I can read in the directory and
rename the picture basied on the exif information but I now want to do
load the directory and exif timestamp into a two column table and then
sort. I have searched for a multi column array or table but have not
found an example. Any suggestions?
Thanks,
-Pablo
--
Posted via
http://www.ruby-...
.
1 Answer
Bira
9/4/2006 2:04:00 PM
0
On 9/4/06, Pablo Tejada <pablo@tejadas.com> wrote:
> I am write a program to sort pictures, I can read in the directory and
> rename the picture basied on the exif information but I now want to do
> load the directory and exif timestamp into a two column table and then
> sort. I have searched for a multi column array or table but have not
> found an example. Any suggestions?
You could probably use an array of arrays, and the sort_by method.
This sorts a two-column table by name:
table = [['name03',<timestamp>], ['name02',<timestamp>], ['name01',<timestamp>]]
table.sort_by { |element| element[0] }
The above example is not "real" Ruby code because of the "<timestamp>"
thingies, but it should work if you use it with your real data.
--
Bira
http://compexplicita.bl...
http://sinfoniaferida.bl...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Column sort (Noobie question
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password