0

Example: If the display name contains "Lambda (?)" then replace with "Lambda (&#955").

I have four various substrings that I'm trying to replace

Here's the part of my stringbuilder code:

sb.Append("<div><a href=\"" + item.URLAliasName + "\" >" + (string.IsNullOrEmpty(item.DisplayName) ? "&nbsp;" : item.DisplayName) + "</a>"...

How do I replace "Lambda (?)" if contained inside item.DisplayName? It may be found anywhere in the display name.

Andy Jr.
  • 95
  • 1
  • 10

2 Answers2

1

Perhaps something like this would work?

item.DisplayName.Replace("Lambda (?)", "Lambda (&#955)");
Deetz
  • 329
  • 1
  • 16
0

You can use String.Replace it takes in two strings as parameters, the value to replace and what to replace it with. It returns the resulting string.

For example: String replacedString = String.Replace("Lambda(?)", "Lambda(&#955");

WereGoingOcean
  • 98
  • 1
  • 10