如何将IP中第三个.后的字符替换成* 如有一字符串str="192.168.0.226"要把226换换成*,怎么做 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string str = "192.168.0.226";str = str.Substring(0, str.LastIndexOf('.')+1);str = str + "*"; string str = "192.168.0.226"; Regex reg = new Regex(@"(?<=\.)\d+(?![\d.])"); string res = reg.Replace(str, "*"); Console.WriteLine(res); 这个要求可以不用正则吧!!! string str = "192.168.0.226"; str = str.Substring(0, str.Length - 3);//将字符串后3位减掉 str += "*";//添加*号 upRegex reg = new Regex(@"(?<=\.)\d{3}(?![\d.])"); 正常的replace或用正规表达式替换。 string str = "192.168.0.226";int strIndex = str.LastIndexOf('.');string newStr = str.substring(0,strIndex+1) + "*"; 这方法好...我还想string[]之后一个一个拼接的... Text='<%# Eval("Ip").ToString() %>'Regex.Replace("", @"((\d{1,3}\.){3,})(\d{1,3})", "$1"+"***"); Regex re = new Regex(@"(?<=\.)\d+$", RegexOptions.None);MatchCollection mc = re.Matches("text");foreach (Match ma in mc){} 再次求助Exception from HRESULT: 0x800A03EC的错误原因!!! 有谁用过jqueryEasyUI? 求助 asp.net在一个母版页里可以link多个css吗? 字体方面的问题!!!!大GGJJ帮帮忙 求一脚本,网页对话筐下打开新窗口问题 送分!!!100 关于“点击图片弹出下拉列表框”的功能!~~~~~~~~~~ RAR文件下载时,为什么少了很多兆,下载的路径要求是Http的路径,请高人指点! win 2003是不是自带.net framework? 如何在服务器控件的触发事件中执行js脚本函数 无论指定什么端口asp.net都提示被占用
str = str.Substring(0, str.LastIndexOf('.')+1);
str = str + "*";
string str = "192.168.0.226"; Regex reg = new Regex(@"(?<=\.)\d+(?![\d.])"); string res = reg.Replace(str, "*"); Console.WriteLine(res);
str = str.Substring(0, str.Length - 3);//将字符串后3位减掉
str += "*";//添加*号
upRegex reg = new Regex(@"(?<=\.)\d{3}(?![\d.])");
int strIndex = str.LastIndexOf('.');
string newStr = str.substring(0,strIndex+1) + "*";
我还想string[]之后一个一个拼接的...
Regex.Replace("", @"((\d{1,3}\.){3,})(\d{1,3})", "$1"+"***");
MatchCollection mc = re.Matches("text");
foreach (Match ma in mc)
{
}