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

x33g5p2x  于2022-01-17 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(209)

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

Float.toString介绍

[英]Returns a string representation of this Float object. The primitive float 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(Float value) {
 return value.toString();
}

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

@Override
  public String toString () {
    String result = "";
    for (int i = 0; i < data.length; i += 3) {
      result += Float.toString(data[i]) + ", " + Float.toString(data[i + 1]) + ", " + Float.toString(data[i + 2]) + "\n";
    }
    return result;
  }
}

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

@Override
  public String toString () {
    String result = "";
    for (int i = 0; i < data.length; i += 3) {
      result += Float.toString(data[i]) + ", " + Float.toString(data[i + 1]) + ", " + Float.toString(data[i + 2]) + "\n";
    }
    return result;
  }
}

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

@Override
public Preferences putFloat (String key, float val) {
  properties.put(key, Float.toString(val));
  return this;
}

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

@Override
public Preferences putFloat (String key, float val) {
  properties.put(key, Float.toString(val));
  return this;
}

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

@Override
public Preferences putFloat (String key, float val) {
  properties.put(key, Float.toString(val));
  return this;
}

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

@Override
public Preferences putFloat (String key, float val) {
  properties.put(key, Float.toString(val));
  return this;
}

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

@Override
public Preferences putFloat (String key, float val) {
  properties.put(key, Float.toString(val));
  return this;
}

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

@Override
public Preferences putFloat (String key, float val) {
  properties.put(key, Float.toString(val));
  return this;
}

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

public void arrayf(float... vargs) {
  s = "";
  if (vargs != null) {
    s = "";
    for (float v: vargs) {
      this.s += Float.toString(v);
    }
  }
}

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

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

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

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

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

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

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

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

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

public Obj3(String s, Float f, int... ints) {
    StringBuilder b = new StringBuilder();
    b.append(s);
    b.append(":");
    b.append(Float.toString(f));
    b.append(":");
    for (int param: ints) {
      b.append(Integer.toString(param));
    }
    output = b.toString();
  }
}

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

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

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

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

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

@GwtIncompatible // Floats.tryParse
public void testTryParseOfToStringIsOriginal() {
 for (float f : NUMBERS) {
  checkTryParse(f, Float.toString(f));
 }
}

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

@Test
public void withUncheckedObjectValue() throws Exception {
  Float value = new Float("99.45");
  this.tag.setPath("myFloat");
  this.tag.setValue(value);
  int result = this.tag.doStartTag();
  assertEquals(Tag.SKIP_BODY, result);
  String output = getOutput();
  assertTagOpened(output);
  assertTagClosed(output);
  assertContainsAttribute(output, "name", "myFloat");
  assertContainsAttribute(output, "type", "radio");
  assertContainsAttribute(output, "value", value.toString());
  assertAttributeNotPresent(output, "checked");
}

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

@Test
public void withCheckedObjectValue() throws Exception {
  this.tag.setPath("myFloat");
  this.tag.setValue(getFloat());
  int result = this.tag.doStartTag();
  assertEquals(Tag.SKIP_BODY, result);
  String output = getOutput();
  assertTagOpened(output);
  assertTagClosed(output);
  assertContainsAttribute(output, "name", "myFloat");
  assertContainsAttribute(output, "type", "radio");
  assertContainsAttribute(output, "value", getFloat().toString());
  assertContainsAttribute(output, "checked", "checked");
}

相关文章