English 中文(简体)
在案文中删除第html条,没有经常表述
原标题:Remove html code in a text with no regular expression
  • 时间:2010-05-31 07:31:24
  •  标签:
  • html

I am working in the indexation of feeds from Internet. I would like to remove tha html code which appears in some of them. I have used regular expression for the ones i have seen, but I would like to find some way to remove all of them automatically, because I don t know if I have seen all possible html code in my feeds. Is there any possibility? I add an example of things I would like to remove: /0831/oly_g_liukin_576.jpg" height="49" width="41" /> BEIJING - AUGUST 15: Nastia Liukin of the...

问题回答

利用Jsoup 效用,用极好的手段将超文本从护法中删除。

在C#中,它可以研究(它将取消“超额”):

public static String RemoveHtmlTagsFromString(String source)
{
   char[] array = new char[source.Length];
   int arrayIndex = 0;
   bool inside = false;

   foreach (char let in source)
   {
       if (let ==  < )
       {
           inside = true;
           continue;
       }

       if (let ==  > )
       {
           inside = false;
           continue;
       }

       if (!inside)
       {
           array[arrayIndex] = let;
           arrayIndex++;
       }
   }
   return new string(array, 0, arrayIndex);
}




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签