Java Double Number Truncate truncDouble(double val)

Here you can find the source of truncDouble(double val)

Description

trunc Double

License

Open Source License

Declaration

public static String truncDouble(double val) 

Method Source Code

//package com.java2s;

public class Main {
    public static String truncDouble(double val) {
        return String.valueOf(val).replaceAll("0+$", "").replaceAll("\\.$", "");
    }/*from  w w w  .  j  ava 2  s .c  o m*/
}

Related

  1. truncateDoubleToInt(double x)
  2. truncateNaN(double[] values)
  3. truncateNoSciNotation(double d, int decimals)
  4. truncateRows(double[][] matrix, int nCols)
  5. truncateToTwoDecimals(double value)
  6. truncDouble(Double value, int decimals)