using System;
public class Example
{
public static void Main()
{
string[] strSource = { "<b>bold</b>", "<H1>header</H1>"};
foreach (string s in strSource)
{
string item = s;
if (item.Trim().EndsWith(">"))
{
int endTagStartPosition = item.LastIndexOf("</");
if (endTagStartPosition >= 0 )
item = item.Substring(0, endTagStartPosition);
if (item.Trim().StartsWith("<"))
{
int openTagEndPosition = item.IndexOf(">");
if (openTagEndPosition >= 0)
item = item.Substring(openTagEndPosition + 1);
}
}
Console.WriteLine(item);
}
}
}
|