Example #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            int num = 0;

            int.TryParse(txtnum.Text, out num);
            string[]      key1 = txtgjc1.Lines;
            string[]      key2 = txtgjc2.Lines;
            string[]      key3 = txtgjc3.Lines;
            string[]      hz   = txthz.Lines;
            Random        r    = new Random();
            List <string> jg   = new List <string>();
            string        temp = "";

            if (num != 0)
            {
                string formatstr = txtscgs.Text;
                //生成随机后替换【地名】
                for (int i = 0; i < num; i++)
                {
                    temp = formatstr;
                    if (key1.Length > 0)
                    {
                        temp = temp.Replace("【关键词1】", key1[r.Next(key1.Length)]);
                    }
                    if (key2.Length > 0)
                    {
                        temp = temp.Replace("【关键词2】", key2[r.Next(key2.Length)]);
                    }
                    if (key3.Length > 0)
                    {
                        temp = temp.Replace("【关键词3】", key3[r.Next(key3.Length)]);
                    }
                    if (hz.Length > 0)
                    {
                        temp = temp.Replace("【后缀】", hz[r.Next(hz.Length)]);
                    }
                    jg.Add(temp);
                }
                txtjg.Lines = AShelp.delreStrings(jg);
            }
            else
            {
                MessageBox.Show("请输入生成数量!");
            }
        }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     string[] s = textBox1.Lines;
     s = AShelp.delreStrings(s);
     textBox2.Lines = s;
 }
Example #3
0
 private void button6_Click(object sender, EventArgs e)
 {
     textBox1.Lines = AShelp.delreStrings(textBox1.Lines);
 }