how do extract decimal number from string in c#

后端 未结 7 1679
Happy的楠姐
Happy的楠姐 2020-12-01 03:58
string sentence = \"X10 cats, Y20 dogs, 40 fish and 1 programmer.\";

 string[] digits = Regex.Split (sentence, @\"\\D+\");

for this code i get val

相关标签:
7条回答
  • 2020-12-01 04:48

    try

    Regex.Split (sentence, @"[^0-9\.]+")
    
    0 讨论(0)
提交回复
热议问题