org.encog.util.csv
Class CSVFormat

java.lang.Object
  extended by org.encog.util.csv.CSVFormat
All Implemented Interfaces:
Serializable

public class CSVFormat
extends Object
implements Serializable

Specifies a CSV format. This allows you to determine if a decimal point or decimal comma is uses. It also specifies the character that should be used to separate numbers.

See Also:
Serialized Form

Field Summary
static CSVFormat DECIMAL_COMMA
          Use a decimal comma, and a semicolon to separate numbers.
static CSVFormat DECIMAL_POINT
          Use a decimal point, and a comma to separate numbers.
static CSVFormat EG_FORMAT
          EG files, internally use a decimal point and comma separator.
static CSVFormat ENGLISH
          Decimal point is typically used in English speaking counties.
 
Constructor Summary
CSVFormat()
          By default use USA conventions.
CSVFormat(char decimal, char separator)
          Construct a CSV format with he specified decimal and separator characters.
 
Method Summary
 String format(double d, int digits)
          Format the specified number to a string with the specified number of fractional digits.
 char getDecimal()
           
static char getDecimalCharacter()
          Get the decimal character currently in use by the computer's default location.
 NumberFormat getNumberFormatter()
           
 char getSeparator()
           
 boolean isValid(String str)
          Determine if the string can be parsed.
 double parse(String str)
          Parse the specified string to a double.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DECIMAL_POINT

public static final CSVFormat DECIMAL_POINT
Use a decimal point, and a comma to separate numbers.


DECIMAL_COMMA

public static final CSVFormat DECIMAL_COMMA
Use a decimal comma, and a semicolon to separate numbers.


ENGLISH

public static final CSVFormat ENGLISH
Decimal point is typically used in English speaking counties.


EG_FORMAT

public static final CSVFormat EG_FORMAT
EG files, internally use a decimal point and comma separator.

Constructor Detail

CSVFormat

public CSVFormat()
By default use USA conventions.


CSVFormat

public CSVFormat(char decimal,
                 char separator)
Construct a CSV format with he specified decimal and separator characters.

Parameters:
decimal - The decimal character.
separator - The separator character.
Method Detail

getDecimalCharacter

public static char getDecimalCharacter()
Get the decimal character currently in use by the computer's default location.

Returns:
The decimal character used.

format

public String format(double d,
                     int digits)
Format the specified number to a string with the specified number of fractional digits.

Parameters:
d - The number to format.
digits - The number of fractional digits.
Returns:
The number formatted as a string.

getDecimal

public char getDecimal()
Returns:
The decimal character.

getNumberFormatter

public NumberFormat getNumberFormatter()
Returns:
The number formatter.

getSeparator

public char getSeparator()
Returns:
The separator character.

isValid

public boolean isValid(String str)
Determine if the string can be parsed.

Parameters:
str - The string to compare.
Returns:
True, if the string can be parsed.

parse

public double parse(String str)
Parse the specified string to a double.

Parameters:
str - The string to parse.
Returns:
The parsed number.


Copyright © 2014. All Rights Reserved.