I have a string and I need to make a specific word Bold by surrounding it with <b>
, so that when it will be rendered the text must be bold.
e.g.
String word = "a1c"
String myString = "The allergy type a1c should be written A1C."
I can do the following:
String1.Replace(word,"<b>"+word+"<b>")
but it will change all the A1c word to "a1c" irrespective of the original word's case.
"The allergy type <b>a1c<b> should be written <b>A1C<b>."
How can I do it without changing case, so that i can get output as
I know we can do it with a loop and index, but I wanted to know the best way that make use of advanced terms like RegEx or Linq or any small inbuilt machanism.