查找字符串中的所有数字

实现效果:

  

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            int result;
            foreach (char c in textBox1.Text.ToCharArray()) {
                if (int.TryParse(c.ToString(), out result)) {
                    label2.Text += (result + " ");
                }
            }
        }
原文地址:https://www.cnblogs.com/feiyucha/p/10079580.html