public static string StripAllTags(string input)
{
char[] array = new char[input.Length];
int arrayIndex = 0;
bool inside = false;
for (int i = 0; i < input.Length; i++)
{
char let = input[i];
if (let == '<')
{
inside = true;
continue;
}
if (let == '>')
{
inside = false;
continue;
}
if (!inside)
{
array[arrayIndex] = let;
arrayIndex++;
}
}
return new string(array, 0, arrayIndex);
}
{
char[] array = new char[input.Length];
int arrayIndex = 0;
bool inside = false;
for (int i = 0; i < input.Length; i++)
{
char let = input[i];
if (let == '<')
{
inside = true;
continue;
}
if (let == '>')
{
inside = false;
continue;
}
if (!inside)
{
array[arrayIndex] = let;
arrayIndex++;
}
}
return new string(array, 0, arrayIndex);
}
0 comments:
Post a Comment