Skip to main content

Sorting letters within a string alphabetically

Hey everybody,

I hope that someone can help me with my problem:
I'm trying to built a function that can sort the letters within a string alphabetically.
I figured out how to do it in Excel, but I don't know how to get it done in IDEA Basic.

Option Explicit
Public Function sortieren(zelle) As String
Dim objAL As Object
Dim I As Integer
Set objAL = CreateObject("System.Collections.Arraylist")
With objAL
For I = 1 To Len(zelle.Text)
.Add (Mid(zelle.Text, I, 1))
Next
.Sort
sortieren = Join(.toArray, "")
End With
Set objAL = Nothing
End Function

Thanks a lot

Brian Element Wed, 11/21/2018 - 07:07

In reply to by stephanfassbender

No problem Stephan, glad I could help.  Just out of curiousity why would you be doing something like this?  I am alwasy interested in different ways to use IDEA.

Brian