Hello friends, With this very first post of our new Blog GimiBits, we start our whole new journey contributing to information technology.
Our First post is about the logic to remove the HTML tags from the given string with C# (C Sharp) programming language. Logic is very Simple to Implement, we take up a string and for its each index char we find the opening '<' braces and ignores the inside content until the closing '>' braces is not encountered and save to another char[] datatype.
Here is a function based Implementation of the logic:
Please Share this post and like us on Facebook.
All Regards,
Jaskaran SH SD
Editor in Chief
Our First post is about the logic to remove the HTML tags from the given string with C# (C Sharp) programming language. Logic is very Simple to Implement, we take up a string and for its each index char we find the opening '<' braces and ignores the inside content until the closing '>' braces is not encountered and save to another char[] datatype.
Here is a function based Implementation of the logic:
public string RemoveHtmlTags(string Html)Post any problems encountered in the comments. Thanks for visiting GimiBits.
{
string content = Html;
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);
}
Please Share this post and like us on Facebook.
All Regards,
Jaskaran SH SD
Editor in Chief
Comments
Post a Comment