All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.tablesaw.columns.strings.StringParser Maven / Gradle / Ivy

package tech.tablesaw.columns.strings;

import com.google.common.collect.Lists;
import tech.tablesaw.api.ColumnType;
import tech.tablesaw.columns.AbstractColumnParser;
import tech.tablesaw.io.ReadOptions;

public class StringParser extends AbstractColumnParser {

    public StringParser(ColumnType columnType) {
        super(columnType);
    }

    public StringParser(ColumnType columnType, ReadOptions readOptions) {
        super(columnType);
        if (readOptions.missingValueIndicator() != null) {
            missingValueStrings = Lists.newArrayList(readOptions.missingValueIndicator());
        }
    }

    @Override
    public boolean canParse(String s) {
        return true;
    }

    @Override
    public String parse(String s) {
        if (isMissing(s)) {
            return StringColumnType.missingValueIndicator();
        }
        return s;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy