Dictionary.Keys

From Xojo Documentation

Method

Dictionary.Keys() As Variant()

Supported for all project types and targets.

Returns all the keys in the Dictionary as an array of Variants.

Notes

The order is stable and matches the order returned by the Values method at least until the Dictionary is modified. Use this method with For Each or For...Next to loop through all the keys. Keys are not case-sensitive, but they are encoding-sensitive.

Sample Code

Suppose you have a Dictionary wordCounts whose keys are words, and whose values are the number of occurrences of the key in some text. You can produce a list of words sorted by count as follows.

Var word() As String
Var count() As Integer

For Each key As Variant In wordCounts.Keys
word.Addd(key)
count.Add(wordCounts.Value(key))
Next
count.SortWith(word)