java.lang.Double.toString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(315)

本文整理了Java中java.lang.Double.toString()方法的一些代码示例,展示了Double.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Double.toString()方法的具体详情如下:
包路径:java.lang.Double
类名称:Double
方法名:toString

Double.toString介绍

[英]Returns a string representation of this Double object. The primitive double value represented by this object is converted to a string exactly as if by the method toString of one argument.
[中]返回此双精度对象的字符串表示形式。此对象表示的原语双精度值被转换为字符串,就像通过一个参数的toString方法一样。

代码示例

代码示例来源:origin: google/guava

@Override
protected String doBackward(Double value) {
 return value.toString();
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a new {@code MediaType} for the given type, subtype, and quality value.
 * @param type the primary type
 * @param subtype the subtype
 * @param qualityValue the quality value
 * @throws IllegalArgumentException if any of the parameters contain illegal characters
 */
public MediaType(String type, String subtype, double qualityValue) {
  this(type, subtype, Collections.singletonMap(PARAM_QUALITY_FACTOR, Double.toString(qualityValue)));
}

代码示例来源:origin: google/guava

/**
 * Returns the String representation of the current value.
 *
 * @return the String representation of the current value
 */
public String toString() {
 return Double.toString(get());
}

代码示例来源:origin: spring-projects/spring-framework

public void arrayd(double... vargs) {
  s = "";
  if (vargs != null) {
    s = "";
    for (double v: vargs) {
      this.s += Double.toString(v);
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

public String printDouble(Double d) {
  return d.toString();
}

代码示例来源:origin: libgdx/libgdx

/** Appends the string representation of the specified {@code double} value. The {@code double} value is converted to a string
 * according to the rule defined by {@link String#valueOf(double)}.
 * 
 * @param d the {@code double} value to append.
 * @return this builder.
 * @see String#valueOf(double) */
public StringBuilder append (double d) {
  append0(Double.toString(d));
  return this;
}

代码示例来源:origin: libgdx/libgdx

/** Inserts the string representation of the specified {@code double} value at the specified {@code offset}. The {@code double}
 * value is converted to a String according to the rule defined by {@link String#valueOf(double)}.
 * 
 * @param offset the index to insert at.
 * @param d the {@code double} value to insert.
 * @return this builder.
 * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}.
 * @see String#valueOf(double) */
public StringBuilder insert (int offset, double d) {
  insert0(offset, Double.toString(d));
  return this;
}

代码示例来源:origin: libgdx/libgdx

/** Appends the string representation of the specified {@code double} value. The {@code double} value is converted to a string
 * according to the rule defined by {@link String#valueOf(double)}.
 * 
 * @param d the {@code double} value to append.
 * @return this builder.
 * @see String#valueOf(double) */
public StringBuilder append (double d) {
  append0(Double.toString(d));
  return this;
}

代码示例来源:origin: libgdx/libgdx

/** Inserts the string representation of the specified {@code double} value at the specified {@code offset}. The {@code double}
 * value is converted to a String according to the rule defined by {@link String#valueOf(double)}.
 * 
 * @param offset the index to insert at.
 * @param d the {@code double} value to insert.
 * @return this builder.
 * @throws StringIndexOutOfBoundsException if {@code offset} is negative or greater than the current {@code length()}.
 * @see String#valueOf(double) */
public StringBuilder insert (int offset, double d) {
  insert0(offset, Double.toString(d));
  return this;
}

代码示例来源:origin: prestodb/presto

/**
 * Returns the String representation of the current value.
 *
 * @return the String representation of the current value
 */
public String toString() {
 return Double.toString(get());
}

代码示例来源:origin: apache/incubator-dubbo

@Override
  State next(int ch) {
    _value = 256 * _value + (ch & 0xff);
    if (++_length == 8) {
      Double value = Double.longBitsToDouble(_value);
      if (_next.isShift(value))
        return _next.shift(value);
      else {
        printObject(value.toString());
        return _next;
      }
    } else
      return this;
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
  State next(int ch) {
    if (_isFirst)
      _value = (byte) ch;
    else
      _value = 256 * _value + (ch & 0xff);
    _isFirst = false;
    if (++_length == 4) {
      Double value = new Double(_value);
      if (_next.isShift(value))
        return _next.shift(value);
      else {
        printObject(value.toString());
        return _next;
      }
    } else
      return this;
  }
}

代码示例来源:origin: alibaba/druid

@Override
public boolean visit(OracleBinaryDoubleExpr x) {
  print0(x.getValue().toString());
  print('D');
  return false;
}

代码示例来源:origin: alibaba/druid

public boolean visit(OracleBinaryDoubleExpr x) {
  print0(x.getValue().toString());
  print('D');
  return false;
}

代码示例来源:origin: apache/incubator-dubbo

@Override
  State next(int ch) {
    _value = 256 * _value + (ch & 0xff);
    if (++_length == 4) {
      Double value = 0.001 * _value;
      if (_next.isShift(value))
        return _next.shift(value);
      else {
        printObject(value.toString());
        return _next;
      }
    } else
      return this;
  }
}

代码示例来源:origin: prestodb/presto

@Override
public void setDouble(int parameterIndex, double x)
    throws SQLException
{
  checkOpen();
  setParameter(parameterIndex, formatLiteral("DOUBLE", Double.toString(x)));
}

代码示例来源:origin: google/guava

@GwtIncompatible // Doubles.tryParse
public void testTryParseOfToStringIsOriginal() {
 for (double d : NUMBERS) {
  checkTryParse(d, Double.toString(d));
 }
}

代码示例来源:origin: prestodb/presto

@ScalarFunction
@SqlType("varchar(41)")
public static Slice render(@SqlType(StandardTypes.DOUBLE) double value, @SqlType(ColorType.NAME) long color)
{
  return render(utf8Slice(Double.toString(value)), color);
}

代码示例来源:origin: prestodb/presto

@Override
  public Result apply(SampleNode sample, Captures captures, Context context)
  {
    return Result.ofPlanNode(new FilterNode(
        sample.getId(),
        sample.getSource(),
        new ComparisonExpression(
            ComparisonExpression.Operator.LESS_THAN,
            new FunctionCall(QualifiedName.of("rand"), ImmutableList.of()),
            new DoubleLiteral(Double.toString(sample.getSampleRatio())))));
  }
}

代码示例来源:origin: google/guava

/** toString returns current value */
public void testToString() {
 AtomicDouble at = new AtomicDouble();
 assertEquals("0.0", at.toString());
 for (double x : VALUES) {
  at.set(x);
  assertEquals(Double.toString(x), at.toString());
 }
}

相关文章