private static String trimZerosFromEnd ( String string ) { return string . contains ( "." ) ? string . replaceAll ( "0*$" , "" ) . replaceAll ( "\\.$" , "" ) : string ; }
The function to remove trailing zeros from the decimal part of the numerals represented by a string . If there are no digits after the point the point is deleted as well .