ASP.NET,
, <span>. <span> background-color CSS .
,
<asp:Label runat="server">
<span style="background-color:Blue;">Hello</span> World
</asp:Label>
<asp:Label runat="server" Text="<span style='background-color:Blue;'>Hello</span> World" />
EDIT:
, -
StringBuilder builder = new StringBuilder();
builder.Append([start of text]);
builder.Append("<span style=\"background-color:Blue;\">");
builder.Append([text to highlight]);
builder.Append("</span>");
builder.Append([rest of text]);
Label.Text = builder.ToString();
, -
string theTextToMatch = "[Text to match]";
string theText = Label.Text;
int leftIndex = theText.IndexOf(theTextToMatch, StringComparison.OrdinalIgnoreCase);
int rightIndex = leftIndex + theTextToMatch.Trim().Length;
StringBuilder builder = new StringBuilder();
builder.Append(theText , 0, leftIndex);
builder.Append("<span style=\"background-color:Blue;\">");
builder.Append(theText, leftIndex, rightIndex - leftIndex);
builder.Append("</span>");
builder.Append(theText, rightIndex, theText.Length - rightIndex);
Label.Text = builder.ToString();