Anonymous user
Optional parameters: Difference between revisions
m
→{{header|REXX}}: changed a comment to a boxed comment, changed some comments.
m (→{{header|REXX}}: changed a comment to a boxed comment, changed some comments.) |
|||
Line 1,673:
<br><br>The REXX language doesn't have any native sorting functions, so you have to write your own sorting subroutine.
<lang rexx>sortStrings: procedure expose @. /*stemmed array is named: @. */
col=1; reverse='NO'; order='LEXICOGRAPHIC'
arg options
do j=1 for words(options); x=word(options,j)
select
when datatype(x, 'W') then col=x/1
when pos('=', x)==0 then order=x
otherwise parse var x nam '=' value
end /*select*/
end /*j*/
/*╔═══════════════════════════════════════════════════════════╗
║
║
║
╚═══════════════════════════════════════════════════════════╝*/
... main body of string sort here ...
return /*stick a fork in it, we're done.*/</lang>
return</lang>▼
An example use is:
<lang rexx>/*REXX example
/*
call sortStrings 'Reverse=no' 3
/*stick a fork in it, we're done.*/
=={{header|Ruby}}==
|