CoreClasses Xojo Plugin

PrefixDictionaryCaseInsensitive.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. In this version of the dictionary the prefix is case insensitive.

Example usage:


var d As new EinhugurCollections.PrefixDictionaryCaseInsensitive()
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

PrefixDictionaryCaseInsensitive Class