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位之间的数字递归真是个神奇的东西,当时学C的时候就没搞明白,学C#又遇到例子了。 public int SumXTo1(int x) &n...
事件的拥有者同时是事件的响应者using System; using System.Windows.Forms; /// <summary> /// 事件的拥有者同时是事件的响应者 /// </summary> na...
虽然没有必要,但是还是先看看自定义的泛型委托:namespace _20200402 { class Program { &nb...
用于匹配输入文本的模式string s = "this is a test!"; string res = Regex.Replace(s, "^",&nbs...
C# 与文件访问相关的常用的类:File类、Directory类、Path类、FileInfo类、DirectoryInfo类、FileSystemInfo类、FileSystemWatcher类以上几个类均在System.IO命名空间下。挨个说吧:File类:静态类,只有静态方法,用于移...
今天突然想C#中,用数组中的Max()方法和直接通过比较获取最大值的时间谁快,于是试了试: static void Main(string[] args) &nb...