Beispiel #1
0
 private static string HighlightMatchingWord(MatchResult matchResult, string input)
 {
     if (matchResult.MatchingValue == string.Empty) // don't highlight
         return input;
     return input.Replace(matchResult.MatchingValue, "<strong>" + matchResult.MatchingValue + "</strong>");
 }
Beispiel #2
0
        private static string GetResultAsTableRow(MatchResult matchResult, MatchType matchType)
        {
            const string htmlRow = "<tr><td class='matchTableFirstCell'>{3}<td class='matchTableContentCell'>{0}</td><td class='matchTableIconCell'><img src='Styles/Images/{1}.png' /></td><td class='matchTableContentCell'>{2}</td></tr>";

            string returnValue = string.Format(htmlRow, HighlightMatchingWord(matchResult, matchResult.FirstValue), matchResult.IsMatch(), HighlightMatchingWord(matchResult, matchResult.SecondValue), matchType.GetTitle());

            return returnValue;
        }