![JAR search and dependency download from the Maven repository](/logo.png)
org.jsapar.text.format.CharacterFormat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsapar Show documentation
Show all versions of jsapar Show documentation
The JSaPar package is a java library that provides a parser for flat and CSV (Comma Separated Values) files.
The newest version!
package org.jsapar.text.format;
import org.jsapar.model.CellType;
import org.jsapar.text.Format;
import java.text.ParseException;
public class CharacterFormat implements Format {
@Override
public CellType cellType() {
return CellType.CHARACTER;
}
@Override
public Character parse(String value) throws ParseException {
if (value.length() > 1) {
throw new java.text.ParseException("Invalid characters found while parsing single character.", 1);
} else if (value.length() == 1)
return value.charAt(0);
throw new java.text.ParseException("Empty value found while parsing single character.", 0);
}
@Override
public String format(Object value) throws IllegalArgumentException {
return String.valueOf(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy