本文介绍了Wpf,只保存文本框中的数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我可以保存文本框值中的整数值,例如

如果:textbox.text =hello-1234G

我希望变量A的值为:hello-1234G

和变量B to的值为:1234



谢谢



我的尝试:



没有什么都没有,什么都没有,什么都没有

hello all,
who I can save just the integer value from textbox value, for example
if the: textbox.text = "hello-1234G"
I want the variable A to have the value of: hello-1234G
and variable B to has the value of : 1234

thanks

What I have tried:

nothing ,nothing ,nothing ,nothing ,nothing nothing

推荐答案

string a = textbox.text;  // hello-1234G
string b = string.Join("", input.Where(k => char.IsNumber(k)));  // 1234


\d+

应该这样做。


这篇关于Wpf,只保存文本框中的数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 06:30
查看更多