Home > Back-end >  A number in parentheses
A number in parentheses

Time:09-22

I want to get the 25 + 0 + 0 in parentheses how to achieve
(permanent population urbanization rate (25) + permanent population quantity (0), the actual service population (0)) AVG

CodePudding user response:

Take Numbers using regular expressions,
Urbanization rate will have a decimal point?

CodePudding user response:

This is expected to be in a stack of storage structure and implementation, and then every time I met the bracket was out of the stack, and then determine the contents of the stack is digital, the digital output

CodePudding user response:

There will be a decimal point, specific what to do, is there any shopping

CodePudding user response:

 
String STR="(permanent population urbanization rate (25) + permanent population quantity (0), the actual service population (0)) AVG";
String reg=\ \ "d + \ \.? \ \ d * ";
The Pattern the Pattern=Pattern.com running (reg);
Matcher matcher=pattern.matcher(str);
Double total=0;
While (the matcher. The find ()) {
Total +=Double. ParseDouble (matcher. Group (0));
}
System. The out. Println (total);
regular match it

CodePudding user response:


For the first time to the calculation of transformation, but the second click function will not be able to calculate the conversion is not successful, that what should I do

CodePudding user response:

The first time can give you a zero for the second time the default when the "resident population... "Won't give you switch, you have a look at your form submission and the received data
  • Related