exBK,
In addition to the other comments.
Is the list of Keywords fixed or variable?
Is the Title fixed or variable length? (its it a "Title" or more of "Body
Text"?)
I would consider using StringBuilder.Replace coupled with String.Split.
Something like:
string strTitle = "Microsoft test title for project ABC";
string strKeywords = "title project";
System.Text.StringBuilder sb = new System.Text.StringBuilder(strTitle,
strTitle.Length * 2);
foreach(string word in strKeywords.Split(' '))
sb.Replace(word, "<B>" + word + "</B>");
strTitle = sb.ToString();
The "problem" with the above is "projects" will be converted to
"<B>project</B>s".
The alternative I would consider is a RegEx...
Hope this helps
Jay
"exBK" <ex**@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
I need to replace certain words in a string as below:
strTitle="Microsoft test title for project ABC";
strKeywords="title project";
what I want to do is: "Bold" the keywords "title" and "project" in the
string strTitle.
Microsoft test <b>title</b> for <b>project</b> ABC
Any suggestions on how to do this one ? I am trying to do it in C#.
Thanks!.