0
Iloがforloopを試してみましたが、gridview.Iで複数のキーワードを強調表示しようとしましたが、配列の最初の項目のみを強調表示しています。複数のキーワードを強調表示
protected string HighlightText(string searchWord, string inputText)
{
// string[] strArray = new string[] { "Hello", "Welcome" };
string s = "d,s";
// Split string on spaces.
// ... This will separate all the words.
string[] words = s.Split(',');
for (int i = 0; i < words.Length; i++)
{
//Console.WriteLine(word);
searchWord = words[i];
Regex expression = new Regex(searchWord.Replace(" ", "|"), RegexOptions.IgnoreCase);
return expression.Replace(inputText, new MatchEvaluator(ReplaceKeywords));
}
return string.Empty;
}
アドバンスありがとう。
これが唯一のキーワード「d」を取得Iamは入れていた私は、「s」はまた...
ループ内の 'return'は、最初の繰り返しでその実行を終了します。 –