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".