使用[0-9] +尝试正则表达式。有大量的信息存在,你只需要谷歌! 问候, Asif I have a string as 'MR000000001'. Also the string value can vary from 'MR000000001' to 'MR999999999'.I want to extract the numeric value form that string.I tried TryParse method but it does not work.Please help me out.Thanks in advance. 解决方案 Try :string s = "MR00001012";int val = int.Parse(s.Substring(2)); // first digit starts at position 2Try regular expression with [0-9]+. There are tons of information present, you just need to google!Regards,Asif 这篇关于如何从给定的字符串中提取数值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 23:14