In my ASP.NET page, I have a string (returned from SQL db). I would like to bold certain part of the string text based on given text position.
For example, if I have a string as follows:
"This is an example to show where to bold the text"
And I am given character start position: 6 and end position: 7, then I would bold the word "is" in my string, getting:
"This is an example to show where to bold the text"
Any ideas?
EDIT: Keep in mind I need to use the start/end position as there may be duplicate words in the string.
I.e. modify string (insert markup) from end to start:
var result = str.Insert(7, "</b>").Insert(6 - 1, "<b>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With