我需要帮助来比较文本文件中按行拆分的两个字符串值,并计算比较的字符串。我已经尝试了一些代码但没有得到它。它只需要一个值来比较。如何传递第二个值。
所以包含方法返回 Bool 值我如何计算比较值。
像这样的文本文件:
172.16.50.70,[17/Aug/2017:08:36:36,GET /login2.php HTTP/1.0,200,1575,-,"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"
172.16.50.70,[17/Aug/2017:08:36:37,GET /objections/login.php HTTP/1.0,200,1988,-,"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"
39.51.52.189,[17/Aug/2017:08:36:37,GET /objections/css/style.css HTTP/1.1,200,6198,googleusercontent.com/search?q=cache:aiou.edu.pk/objections/ssearch.php,"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.39 Safari/537.36"
代码
string Files = System.IO.File.ReadAllText(@"C:\info.txt");
string[] SplitByLine = Files.Split('\n');
foreach (var item in SplitByLine)
{
string[] OneRowSplit = item.Split(',');
GetIP = OneRowSplit[0];
LapInfo = OneRowSplit.Last();
string Filess = System.IO.File.ReadAllText(@"C:\info.txt");
string[] SplitByLines = Filess.Split('\n');
string ads = SplitByLines.Contains(GetIP & LapIngo).count(); // this line of code is not valid its only for telling i want some thing like this contain method take only one parameter and i also want to count comapred values
}
千万里不及你
相关分类