Nevron Open Vision Documentation
Framework / Data Structures / String Maps and String Sets
In This Topic
    String Maps and String Sets
    In This Topic

    Nevron Open Vision provides two special classes for working with string sets - the NStringMap and the NStringSet. Although similar to standard maps and sets on the outside, they are implemented differently and provide and optimize way for various string search methods such as:

    The results of these methods depends on whether the string comprisons are case sensitive or not, which is specified by passing true or false to the constructor respectively. The following code example demonstrates how to create and initialize a string set and perform a wildcard serch on it:

    String Set Example
    Copy Code
    string[] Words = new string[] { "bar", "bat", "car", "cat", "far", "fat", "ward", "warda", "wa", "w", "wra", "warhead" };
    
    NStringSet stringSet = new NStringSet(true);
    for (int i = 0; i < Words.Length; i++)
    {
        stringSet.Add(Words[i]);
    }
    
    INSet<string> matches = m_Words.WildcardSearch("*ar");
    

    The set returned by this WildcardSearch method in this case will contain the strings "bar", "car" and "far".

    Note that the optimization of the NStringMap class for the string search methods above comes at the cost of slower access by key. For the NStringMap it is not O(1) as in a hash table based map, but O(log N). That is why you should use the generic NMap class with a string type parameter, when you don't need the special string search methods that the NStringMap offers.
    See Also