how do extract decimal number from string in c#

后端 未结 7 1682
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:41

    Check the syntax lexers for most programming languages for a regex for decimals. Match that regex to the string, finding all matches.

提交回复
热议问题