Meghana M

Meghana M

  • 1.2k
  • 175
  • 23.1k

Replacing tags with another tag in the text using C# console applicati

Dec 15 2023 10:28 AM

<ol start="2">$     tag should replace with -"$" should come for ordered list and " | " for unordered list

<ol start="NaN">   tag should replace with -"$" should come for ordered list and " | " for unordered list

above mentioned tag should add in existing below code

if (!string.IsNullOrEmpty(Value))
{
    if (Value.Contains("<ul>"))
    {
        Value = Value.Replace("<li>", "|").Replace("<ul>", "").Replace("</ul>", "");
    }

    if (Value.Contains("<ol>"))
    {
        Value = Value.Replace("<li>", "$").Replace("<ol>", "").Replace("</ol>", "");
    }

    Value = Value.Replace("</li>", "").Replace("<p>", "").Replace("</p>", "");
}

 


Answers (1)