C# 正则表达式(2)
// pattan = @"[^ahou]"; 表示匹配除ahou之外的字符,^在表示反义
string res4 = Regex.Replace(s, @"[^ahou]", "*");
Console.WriteLine(res4);
res3 = Regex.IsMatch(s, @"^d{5,12}$"); //表示匹配是否是5-12位之间的数字// pattan = @"[^ahou]"; 表示匹配除ahou之外的字符,^在表示反义
string res4 = Regex.Replace(s, @"[^ahou]", "*");
Console.WriteLine(res4);
res3 = Regex.IsMatch(s, @"^d{5,12}$"); //表示匹配是否是5-12位之间的数字虽然没有必要,但是还是先看看自定义的泛型委托:namespace _20200402 { class Program { &nb...
简单用法,一句一句来,便于理解 Func<int, int, int> func = new Func<int, int, int>((int a, int b) => { return a * b; });(int a, int b) => { ret...
Directory类:静态类,主要处理文件目录。方法:CreateDirectory(String)在指定路径中创建所有目录和子目录,除非它们已经存在。返回值是一个DirectoryInfo对象Delete(String)从指定路径删除空目录。无返回值。Exists(String)确定给定路径是否引...
今天突然想C#中,用数组中的Max()方法和直接通过比较获取最大值的时间谁快,于是试了试: static void Main(string[] args) &nb...
将原数组反转,如[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]反转后变为[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]因为数组是引用类型,所以直接在方法中处理即可,C#和Java写法一样,如下: &nb...