2024-09-30 06:12:38 发布
网友
我有一个包含坏网址的文本文件
http images5fanpopcomimagephotos29000000ichigowallpaperkurosakiichigo290694271024768jpg
以及
https smediacacheak0pinimgcomoriginals1219ed1219ed717fc2bfce372759bba2fe1cfegif
是的。我想删除这些长字符串后面的http或https。你知道吗
有人能提出解决办法吗?你知道吗
您可以在每一行中搜索http或https,如果该行长度超过X个字符(例如40个字符),并且其中没有“/”和/或“.”,请删除。你知道吗
System.IO.StringReader strReader = new System.IO.StringReader(input); string line; string output; while ((line = strReader.ReadLine()) != null) { if(line.IndexOf("http") == 0) { if( (line.Length >40) && ((line.Contains('.') == false) || (line.Contains('/') == false)) ) { add = false; } else { add = true; } } else { add = true } if(add) output += line + "\r\n"; }
您可以在每一行中搜索http或https,如果该行长度超过X个字符(例如40个字符),并且其中没有“/”和/或“.”,请删除。你知道吗
相关问题 更多 >
编程相关推荐