|
RE: Sorting: msg#00070lang.smalltalk.squeak.beginners
<< #sortBy: does not return a string. >> I was surprised that the collection returned does not respond to a message like asString. Anyway, this short code works: t _ ('The cow jumped over the moon' sortBy: [ :x :y | x < y ]). s _ String new: t size. 1 to: t size do: [ :i | s at: i put: (t at: i) ]. You can also apply this approach based on inject:into: t _ ('The cow jumped over the moon' sortBy: [ :x :y | x < y ]). t inject: String new into: [ :x :y | x, (String with: y) ]. Mark
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Passing arguments to squeak image, Patrick Collison |
|---|---|
| Next by Date: | Re: Passing arguments to squeak image, subbukk |
| Previous by Thread: | Re: Sorting, Edward Stow |
| Next by Thread: | Re: Sorting, Scott Wallace |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |