org.encog.util.csv
Class CSVFormat
- java.lang.Object
-
- org.encog.util.csv.CSVFormat
-
- All Implemented Interfaces:
- java.io.Serializable
public class CSVFormat extends java.lang.Object implements java.io.SerializableSpecifies 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
Fields Modifier and Type Field and Description static CSVFormatDECIMAL_COMMAUse a decimal comma, and a semicolon to separate numbers.static CSVFormatDECIMAL_POINTUse a decimal point, and a comma to separate numbers.static CSVFormatEG_FORMATEG files, internally use a decimal point and comma separator.static CSVFormatENGLISHDecimal point is typically used in English speaking counties.
-
Constructor Summary
Constructors Constructor and Description CSVFormat()By default use USA conventions.CSVFormat(char decimal, char separator)Construct a CSV format with he specified decimal and separator characters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Stringformat(double d, int digits)Format the specified number to a string with the specified number of fractional digits.chargetDecimal()static chargetDecimalCharacter()Get the decimal character currently in use by the computer's default location.java.text.NumberFormatgetNumberFormatter()chargetSeparator()booleanisValid(java.lang.String str)Determine if the string can be parsed.doubleparse(java.lang.String str)Parse the specified string to a double.
-
-
-
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 java.lang.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 java.text.NumberFormat getNumberFormatter()
- Returns:
- The number formatter.
-
getSeparator
public char getSeparator()
- Returns:
- The separator character.
-
isValid
public boolean isValid(java.lang.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(java.lang.String str)
Parse the specified string to a double.- Parameters:
str- The string to parse.- Returns:
- The parsed number.
-
-
DMelt 3.0 © DataMelt by jWork.ORG