实现效果:
实现代码:
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 + " "); } } }