Home > Net >  Ask: how to extract multiple Numbers from string, including the decimal
Ask: how to extract multiple Numbers from string, including the decimal

Time:12-27


 
String STR="pressure: 097.71 kPa temperature: wet temperature 023.46 degrees, 023.5 degrees humidity: 026.1% RH dew point: 002.9 degrees";

How can extract all Numbers, the result should be:
97.71
23.46
23.5
26.1
2.9
Can't use string segmentation method, because of different device back to string format is not consistent?
Pray god help!!!!!!!!!!

CodePudding user response:

Regular:
[0-9] + | [0-9] + \. [0-9] *?

CodePudding user response:

Can't use string segmentation method? The for loop out Numbers...

CodePudding user response:

Also, a character in a character judgment, made a reservation in the digital range, including the decimal point
  •  Tags:  
  • C#
  • Related