利用c#语言想把
1、 " this.InitializeComponent();"
分割成this Initialize Component
2、"ClassType"
分割成 Class Type
利用c#语言想把
1、 " this.InitializeComponent();"
分割成this Initialize Component
2、"ClassType"
分割成 Class Type
不知道你具体什么规则,按照你给的2个例子
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Q1053314
{
class Program
{
static void Main(string[] args)
{
string[] input = { " this.InitializeComponent();", "ClassType", "static void Main(string[] args)", "using System.Text.RegularExpressions;" };
foreach (var item in input)
{
foreach (Match m in Regex.Matches(" " + item, @"(?<=[\s\.\(\{^a-z])[A-Z]{0,1}[a-z]+"))
Console.Write("found:" + m.Value + " ");
Console.WriteLine();
}
}
}
}
运行结果
found:this found:Initialize found:Component
found:Class found:Type
found:static found:void found:Main found:string found:args
found:using found:System found:Text found:Regular found:Expressions
Press any key to continue . . .
采纳