日期:2014-05-18  浏览次数:20789 次

生成规则字符串
形式如下:
1。字符串ABCD**
2.将*号换成0-9的数字
3.*号的长度不晓得


------解决方案--------------------

用replace就可以。。。

0-9的数字可以随机
------解决方案--------------------
正解。
探讨
形式如下:
1。字符串ABCD**
2.将*号换成0-9的数字
3.*号的长度不晓得

------解决方案--------------------
C# code
        string s = "ABCD**";
        Random r = new Random();
        string ss = Regex.Replace(s, @"\*", delegate(Match match) { return r.Next(10).ToString(); });
        Response.Write(ss);

------解决方案--------------------
C# code
        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/>");
        }