![]() |
Подскажите как разделить список вида
[07.07.2010 21.49.26][samparat:123456] [07.07.2010 21.49.33][usedon:123456] [07.07.2010 21.49.43][sivility:123456] [07.07.2010 21.50.04][fernol:123456] на отдельные листы логина и пороля? |
С# Net Fraemwork 3.5 входной файл in.txt (должен быть в одной директории с программой);
Выходные файлы : out.txt - содержит логин:пароль pass.txt - пароли login.txt - логины [PHP] [COLOR="#000000"]using System; using System.IO; using System.Collections.Generic; using System.Text; using System.Linq; using System.Text.RegularExpressions; namespacestd { classsto { staticvoid Main() { string a=File.ReadAllText("in.txt"); Regex ololo= newRegex(@"(\w+[:]\w+)",RegexOptions.Singleline|RegexOptions.IgnoreCase); MatchCollection collect_math=ololo.Matches(a); StreamWriter sw= newStreamWriter("out.txt",true); foreach (Match item in collect_math) { Console.WriteLine(item); string b=Convert.ToString(item); sw.WriteLine(b); } sw.Close(); varlogin= new List(); varpass= new List(); File.ReadAllLines("out.txt").ToList().ForEach(s=> { vararr=s.Split(':'); login.Add(arr[0]); pass.Add(arr[1]); }); string[]c=File.ReadAllLines("out.txt"); StreamWriter sw0= newStreamWriter("pass.txt",true); StreamWriter sw1= newStreamWriter("login.txt",true); for (int i=0;i[COLOR="#007700"] |
| Время: 02:32 |