Sort the letters of string in alphabetical order: Difference between revisions
Content added Content deleted
m (expanded the scope of the (draft) task a little to include characters, not just letters. So that would now include digits, punctuation, blanks, and other characters.) |
m (→{{header|REXX}}: added wording to the REXX section header.) |
||
Line 54: | Line 54: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
For REXX, it is normally faster to convert an string of characters to a one─character array of characters, |
|||
<br>sort the array, and then convert the array back to a (simple) string. |
|||
A simple bubble sort is used for this example. |
|||
The particular string used is from a typing drill devised by Charles E. Weller in the early 20th century. |
|||
<lang rexx>/*REXX program sorts an array (of any kind of items) using the bubble─sort algorithm.*/ |
<lang rexx>/*REXX program sorts an array (of any kind of items) using the bubble─sort algorithm.*/ |
||
parse arg y /*generate the array elements (items).*/ |
parse arg y /*generate the array elements (items).*/ |