517
SRT( ) Function
Sort String
Formats
Where:
dlm_char$
Delimiter for each string element. If you omit this, the default
delimiter is the SEP character(e.g., $8A$).
fixed_len
Numeric expression. Length of each element in the string (all the same
fixed length).
stmtref
Program line number or label to transfer control to.
string$
String to be sorted.
Returns
Sorted character string.
Description
The SRT( ) function returns a sorted character string. The string elements are
internally sorted into ascending sequence. The order of duplicate elements is
undefined.
Note: To sort a string into descending order, use the NOT( ) function to invert the bits
Format 1: Sort Equal Length Elements
SRT(string$,fixed_len[,ERR=stmtref])
If each element in the string is the same fixed length, use this format to sort the
string.
Examples:
0100 REM To sort in ascending order:
0110 A$="0231405242670291234403242"
0120 PRINT SRT(A$,5)
->RUN
0231403242052421234467029
0200 REM To sort in descending order:
0220 PRINT NOT(SRT(NOT(A$),5))
->RUN
6702912344052420324202314