Chemistry Applets

David N. Blauch


data
Class DataFormat

java.lang.Object
  |
  +--data.DataFormat

public class DataFormat
extends java.lang.Object

This class performs conversions between strings and numbers.

Version:
1.00, 19 September 2000
Author:
David N. Blauch

Constructor Summary
DataFormat()
           
 
Method Summary
static java.lang.String formatDec(double x, int nLength, int nDecimal)
          Returns a string representing a double precision number (x).
static java.lang.String formatSci(double x, int nLength, int nDecimal)
          Returns a string representing a double precision number (x).
static boolean isValid(java.lang.String nbr)
          Evaluates a string to see if it represents a valid number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFormat

public DataFormat()
Method Detail

formatDec

public static java.lang.String formatDec(double x,
                                         int nLength,
                                         int nDecimal)
Returns a string representing a double precision number (x). The string uses a fixed decimal point format. When necessary spaces are added to the beginning of the string to obtain the necessary length.
Parameters:
x - number
nLength - total length of returned string
nDecimal - number of digits to the right of the decimal point

formatSci

public static java.lang.String formatSci(double x,
                                         int nLength,
                                         int nDecimal)
Returns a string representing a double precision number (x). The string uses a scientific notation. The total length of the string must include four additional digits for the E+## notation.
Parameters:
x - number
nLength - total length of returned string
nDecimal - number of digits to the right of the decimal point

isValid

public static boolean isValid(java.lang.String nbr)
Evaluates a string to see if it represents a valid number

Chemistry Applets

David N. Blauch