CTCClassSchedule.Common.Helpers.FormatWithSearchTerm C# (CSharp) Method

FormatWithSearchTerm() public static method

Applies keyword markup to all instances of the searchTerm found in the provided text
public static FormatWithSearchTerm ( string searchTerm, string text ) : string
searchTerm string
text string
return string
        public static string FormatWithSearchTerm(string searchTerm, string text, params object[] args)
        {
            if (String.IsNullOrWhiteSpace(text) || String.IsNullOrWhiteSpace(searchTerm))
            {
                return text;
            }

            if (args != null && args.Length > 0)
            {
                text = String.Format(text, args);
            }
            return Regex.Replace(text, searchTerm, @"<em class='keyword'>$&</em>", RegexOptions.IgnoreCase);
        }