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位之间的数字例子来源于此视频https://www.bilibili.com/video/av1422127?p=4 此例子是想说明有的类主要使用它的事件namespace Wpf_test { /// <summary> &...
简单用法,一句一句来,便于理解 Func<int, int, int> func = new Func<int, int, int>((int a, int b) => { return a * b; });(int a, int b) => { ret...
C# 与文件访问相关的常用的类:File类、Directory类、Path类、FileInfo类、DirectoryInfo类、FileSystemInfo类、FileSystemWatcher类以上几个类均在System.IO命名空间下。挨个说吧:File类:静态类,只有静态方法,用于移...
将原数组反转,如[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]反转后变为[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]因为数组是引用类型,所以直接在方法中处理即可,C#和Java写法一样,如下: &nb...
今天写PIE二次开发加载栅格数据的时候发现类中方法的返回值是接口,之前没怎么写过,在此记录一下。在例子中设计一个接口 ICalculate ,接口中有两个方法, Add() 和 Div() 分别为加法和减法的功能,均有两个参数,参数和返回值的类型都是int类型。设计一个名为Calculat...