Removing HTML tags from string C# ASP


Here is the simple C# program that is used to remove HTML tags from a string, with very simple while and if else statement.
Here is code (C# function):
public static string RemoveHtmlTags(string content){
            char[] array = new char[content.Length];
            int arrayIndex = 0;
            bool inside = false;

            for (int i = 0; i < content.Length; i++)
            {
                char let = content[i];
                if (let == '<')
                {
                    inside = true;
                    continue;
                }
                if (let == '>')
                {
                    inside = false;
                    continue;
                }
                if (!inside)
                {
                    array[arrayIndex] = let;
                    arrayIndex++;
                }
            }
            return new string(array, 0, arrayIndex);
}
thanks g.
:)

Share this:

ABOUT THE AUTHOR

Hello We are OddThemes, Our name came from the fact that we are UNIQUE. We specialize in designing premium looking fully customizable highly responsive blogger templates. We at OddThemes do carry a philosophy that: Nothing Is Impossible