Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是新来的。我只想知道单击按钮时如何从文本框中删除所有数字。例如,如果文本框有文本 hello1,当我单击按钮时,它应该是 hello。
谢谢。
试试这个。
var output = Regex.Replace(textbox.Text, @"[\d-]","");
textBox1.Text = new string(textBox1.Text.Where(t => t <= '0' || t >= '9').ToArray());
这也可以