Decorate-sort-undecorate idiom: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
(→{{header|Ruby}}: typo in code) |
||
Line 710: | Line 710: | ||
# sort by word-size, then lexical: |
# sort by word-size, then lexical: |
||
str = "Rosetta Code is a programming chrestomathy site seven extra words added to this demo" |
str = "Rosetta Code is a programming chrestomathy site seven extra words added to this demo" |
||
p str.split.sort_by{|word| [word.size, word] |
p str.split.sort_by{|word| [word.size, word]} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{out}} |
{{out}} |