Java XML String Create toXmlString(float value)

Here you can find the source of toXmlString(float value)

Description

to Xml String

License

BSD License

Declaration

private static String toXmlString(float value) 

Method Source Code

//package com.java2s;
// Distributed under the OSI-approved BSD 3-Clause License.

public class Main {
    private static String toXmlString(float value) {
        if (Float.isNaN(value)) {
            return "NaN";
        } else if (value == Float.POSITIVE_INFINITY) {
            return "INF";
        } else if (value == Float.NEGATIVE_INFINITY) {
            return "-INF";
        } else {/* w w  w .  j av a2s  .com*/
            return Float.toString(value);
        }
    }

    private static String toXmlString(double value) {
        if (Double.isNaN(value)) {
            return "NaN";
        } else if (value == Double.POSITIVE_INFINITY) {
            return "INF";
        } else if (value == Double.NEGATIVE_INFINITY) {
            return "-INF";
        } else {
            return Double.toString(value);
        }
    }
}

Related

  1. toXML(String s)
  2. toXML(String string)
  3. toXML(String valor)
  4. toXMLString(final boolean[] array)
  5. toXMLString(String in)
  6. toXMLString(String javaString)
  7. toXMLString(String org)
  8. toXmlString(String s)