use of tech.tablesaw.io.csv.CsvReadOptions in project symja_android_library by axkr.
the class SemanticImportString method evaluate.
@Override
public IExpr evaluate(final IAST ast, EvalEngine engine) {
if (!(ast.arg1() instanceof IStringX)) {
return F.NIL;
}
IStringX arg1 = (IStringX) ast.arg1();
try {
String contents = arg1.toString();
char delimiter = determineDelimiter(contents);
CsvReadOptions.Builder builder = CsvReadOptions.builderFromString(contents).separator(delimiter);
CsvReadOptions options = builder.build();
Table table = Table.read().usingOptions(options);
return ASTDataset.newTablesawTable(table);
} catch (Exception rex) {
LOGGER.log(engine.getLogLevel(), "SemanticImportString ", rex);
return F.NIL;
}
}
Aggregations