生成规则字符串
形式如下:
1。字符串ABCD**
2.将*号换成0-9的数字
3.*号的长度不晓得
[解决办法]
用replace就可以。。。
0-9的数字可以随机
[解决办法]
正解。
string s = "ABCD**"; Random r = new Random(); string ss = Regex.Replace(s, @"\*", delegate(Match match) { return r.Next(10).ToString(); }); Response.Write(ss);
[解决办法]
string s = "ABCD**"; string ss = s.Replace("*", ""); int count = s.Length - ss.Length; for (int i = 0; i < Math.Pow(10, count); i++) { string r = ss + i.ToString("D" + count); Response.Write(r + "<br/>"); }