[Newbies] Sorting

Chris Cunnington cunnington at sympatico.ca
Wed May 16 17:10:47 UTC 2007


Hi Squeakers, 

I have a string: 'Hello'.

To reverse the letters I write:

 a := 'Hello' reverse.

And I get 'olleH'. 

How do I sort the letters alphabetically? So I get 'eHllo'?

 a := 'Hello' sortBy: [:x :y | a < b ]

What parameter do you use to sort the letters? Do you have to convert them
to a number, an Ascii or Unicode number first, and then sort those numbers?


Cheers, 
Chris Cunnington



More information about the Beginners mailing list