如何在 C# 中避免使用数字(卢比)中的字符串?

How to Avoid the string from number(for rupees) in c#?

我是 c# 中的新手,所以如何替换字符串

例如:-

 label1.Content = "Bal.Rs." + 100;

如何在我们从 label1.Text 保存的同时获得 100???

给你:

string OnlyNumbered = Regex.Match(label1.Content.ToString(), @"\d+").Value;

尝试这样做

 string input="abc 123"
 string result = Regex.Replace(input, @"[^\d]", "");

 //output result=123

^\d 指定不是数字

希望这会有所帮助