using QFSW.QC.Utilities; namespace QFSW.QC { /// /// Common utilities used by the suggestion system. /// public static class SuggestorUtilities { /// /// Determines if a prompt is compatible with a string suggestion. /// /// The prompt to test. /// The string suggestion to test again. /// The options used by the suggestor. /// If the prompt is compatible. public static bool IsCompatible(string prompt, string suggestion, SuggestorOptions options) { if (prompt.Length > suggestion.Length) { return false; } if (options.Fuzzy) { return options.CaseSensitive ? suggestion.Contains(prompt) : suggestion.ContainsCaseInsensitive(prompt); } return suggestion.StartsWith(prompt, !options.CaseSensitive, null); } } }