### Sort Multiline String

Example to sort a multiline string ascending, where the lines are seperated by CRLF.
' Parameter: The String to sort
' Returns String ASC
`Sub sortMultiLineString(mls As String) As String
If mls.Length = 0 Then Return ""
' Split the text
Dim s() As String = Regex.Split(CRLF, mls)
Dim l As List
l.Initialize
l.AddAll(s)
l.sort(True)
mls = ""
For i = 0 To s.Length - 1
mls = mls & l.Get(i) & CRLF
Next
Return mls
End Sub`
Example sorting Form TextArea
Private ta As TextArea
ta.Text = sortMultiLineString(ta.Text)

Changed: , Category: Strings, File: T6C255M1858.htm, ID: 1858