CoreClasses Xojo Plugin

PrefixDictionary.SearchByPrefix Method

Finds all values in the dictionary which have given prefix.

SearchByPrefix(
   prefix as String) as Variant()

Parameters

prefix
The prefix to search for.

Returns

Variant()

Remarks

This routine is very fast and does not need to loop through all the data.

If prefix entered is empty string then empty result will be returned. If you want all the values from the dictionary then use the Values function.

The SearchByPrefix function is encoding-sensitive and in this version of the prefix dictionary it is case sensitive also.

Example usage:


var d As new EinhugurCollections.PrefixDictionary()
d.Value("Can") = "Can"
d.Value("Color") = "Color"
d.Value("Canister") = "Canister"
d.Value("Car") = "Car"
d.Value("Cart") = "Cart"
d.Value("Apple") = "Apple"

// This lookup will return Can, Canister, Car, Cart
var results as Variant = d.SearchByPrefix("Ca")

// This lookup will return Car, Cart
var results2 as Variant = d.SearchByPrefix("Car")

See Also

PrefixDictionary Class