Cadmium::Trie
Inherits Reference / Object
Constructors
new(case_sensitive : Bool = true)
SourceInstance methods
add(string : String)
Adds a string to the Trie
Returns true if the string was already present, and false otherwise
add(strings : Array(String))
Adds an array of strings to the Trie
Returns true if all of the strings were already present, and false otherwise
find_prefix(lookup)
Finds the largest prefix matching the prefix of lookup
Returns a 2-Tuple. If a prefix was found, it will be the first element; otherwise, the first element will be nil. The second element will be the substring that was not matched.