Xbasic

SORTSTRING_BY_LENGTH Function

Syntax

New_List as C = sortstring_by_length(C string [,C direction ])

Arguments

New_List

The new sorted list.

string

The original CR-LF delimited list.

direction

Optional. Default = Ascending. Character

Description

Sort a CRLF delimited string from shortest entries to longest entries

Discussion

The SORTSTRING_BY_LENGTH() function sorts a CR-LF delimited list by the length of its entries.

Example

dim s as C
s = 
#a
#ab
#abc
#abcd
#af
#%a%
? sortstring_by_length(s)
= a
af
ab
abc
abcd

See Also