可以说:我有一个用户输入“placeofjo.blogspot.com”如何删除文本文件中的字符串,如果不匹配用户输入字符串?
我的代码从该网站提取链接并将链接放置在文本文件中。
现在的文本文件有这样的内容:
http://www.twitter.com/jozefinfin/
http://www.facebook.com/jozefinfin/
http://placeofjo.blogspot.com/2008_08_01_archive.html
http://placeofjo.blogspot.com/2008_09_01_archive.html
http://placeofjo.blogspot.com/2008_10_01_archive.html
http://placeofjo.blogspot.com/2008_11_01_archive.html
http://placeofjo.blogspot.com/2008_12_01_archive.html
http://placeofjo.blogspot.com/2009_01_01_archive.html
http://placeofjo.blogspot.com/2009_02_01_archive.html
http://placeofjo.blogspot.com/2009_03_01_archive.html
http://placeofjo.blogspot.com/2009_04_01_archive.html
http://placeofjo.blogspot.com/2009_05_01_archive.html
http://placeofjo.blogspot.com/2009_06_01_archive.html
http://placeofjo.blogspot.com/2009_07_01_archive.html
http://placeofjo.blogspot.com/2009_08_01_archive.html
http://placeofjo.blogspot.com/2009_09_01_archive.html
http://placeofjo.blogspot.com/2009_10_01_archive.html
http://placeofjo.blogspot.com/2009_11_01_archive.html
http://placeofjo.blogspot.com/2010_01_01_archive.html
http://placeofjo.blogspot.com/2010_02_01_archive.html
http://placeofjo.blogspot.com/2010_04_01_archive.html
http://placeofjo.blogspot.com/2010_06_01_archive.html
http://placeofjo.blogspot.com/2010_07_01_archive.html
http://placeofjo.blogspot.com/2010_08_01_archive.html
http://placeofjo.blogspot.com/2010_10_01_archive.html
http://placeofjo.blogspot.com/2010_11_01_archive.html
http://placeofjo.blogspot.com/2011_01_01_archive.html
http://placeofjo.blogspot.com/2011_02_01_archive.html
http://placeofjo.blogspot.com/2011_03_01_archive.html
http://endlessdance.blogspot.com
http://blogskins.com/me/aaaaaa
http://weheartit.com
我想删除
http://www.twitter.com/jozefinfin/
http://www.facebook.com/jozefinfin/
http://endlessdance.blogspot.com
http://blogskins.com/me/aaaaaa
http://weheartit.com
且仅这仅仅是类似于用户的输入字符串离开它。 我该怎么做?
的文本文件所需的内容:
http://placeofjo.blogspot.com/2008_08_01_archive.html
http://placeofjo.blogspot.com/2008_09_01_archive.html
http://placeofjo.blogspot.com/2008_10_01_archive.html
" "
" "
如果该模式被编译一次,然后在一个循环,而不是多用,会那么性能表现如此糟糕呢?那就是我会做的。 – ArtB 2011-04-04 15:22:10
@ArtB那么,在这种情况下,性能不会降低太多。因为只有一条线会被考虑,但是如果你的线包含数千个字符,它也不是一个好的选择。 – 2011-04-04 17:35:50