正则的使用
using System.Text.RegularExpressions;
string regex = "I am a boy";
string newstr = Regex.Replace(regex, "^", "开始:");
Console.WriteLine(newstr);

^匹配开头,直接替换开头为“开始:”

扩展 $ 表示匹配结尾

Replace方法,为替换方法


首页 我的博客
粤ICP备17103704号