using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace vs2012csharp
{
class Program
{
ArrayList fileList;
static int ThreadNum = 3;
static string ProposalExtractLessInfo(string inputfile, string outputfile1, string outputfile2)
{
string paperText = File.ReadAllText(inputfile, Encoding.Default);
string strRegexProposer = @"申\s+请\s+人:(?<Proposer>\w+)\s+[^\r\n]+[\r\n]+依托单位:(?<Proposer_Org>\w+)";
Regex regProposer = new Regex(strRegexProposer, RegexOptions.Singleline);
Match matchProposer = regProposer.Match(paperText);
string strRegexExpCode = @"申请代码\s+((?:[A-Z\d]+:\w+\s+)+)";
Regex regExpCode = new Regex(strRegexExpCode, RegexOptions.Singleline);
Match matchCode = regExpCode.Match(paperText);
//Console.WriteLine(matchCode.Groups[1].Value);
//Console.WriteLine(matchCode.Groups[2].Value);
string[] codeDesArr = matchCode.Groups[1].Value.Split('
C#多线程处理文件的简单例子
最新推荐文章于 2023-12-26 09:36:49 发布
这个C#程序使用多线程从文本文件中提取特定信息,如申请人、代码、关键词等,并将结果写入新文件。程序首先读取指定文件夹中的所有.txt文件,然后创建多个线程进行并行处理,每个线程处理文件的一部分。提取到的信息包括申请代码数量、代码详情、关键词等。
摘要由CSDN通过智能技术生成