java eliminate redundant after the decimal point 0 (use regular expressions).

. 1  Private  static String STRs (String STR) {
 2          IF ( "." Str.indexOf ()> 0 ) {
 . 3              STR = str.replaceAll ( "0 + $?", ""); // delete the mantissa is 0 character 
. 4              STR = str.replaceAll ( "$ [.]", ""); // end if the decimal point, then remove 
. 5          }
 . 6          return STR;
 . 7          // the TODO Auto-Generated Method Stub 
. 8   }

 

Guess you like

Origin www.cnblogs.com/mengweihong/p/11305183.html