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#的五大数据类型: 类(Class) 结构体(Structures) 枚举(Enumerations) 接口(In...
虽然没有必要,但是还是先看看自定义的泛型委托: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...
这两天用C#写了个2048游戏练手,在需求上如果最终达到了2048,那么应该给出一句提示或者弹出一个消息框,提示达到了2048,而且这个提示只需要展示一次,关闭提示后应该继续游戏而不会重复提示,可以使用bool类型的全局变量进行控制。如下:public partial class...
用于匹配输入文本的模式string s = "this is a test!"; string res = Regex.Replace(s, "^",&nbs...