本文整理汇总了Java中org.apache.commons.csv.CSVFormat.withDelimiter方法的典型用法代码示例。如果您正苦于以下问题:Java CSVFormat.withDelimiter方法的具体用法?Java CSVFormat.withDelimiter怎么用?Java CSVFormat.withDelimiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.csv.CSVFormat
的用法示例。
在下文中一共展示了CSVFormat.withDelimiter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatForDelimiter
import org.apache.commons.csv.CSVFormat; //导入方法依赖的package包/类
private static CSVFormat formatForDelimiter(char delimiter) {
CSVFormat format = CSV_FORMAT;
if (delimiter != format.getDelimiter()) {
format = format.withDelimiter(delimiter);
}
return format;
}
示例2: getActiveFormat
import org.apache.commons.csv.CSVFormat; //导入方法依赖的package包/类
CSVFormat getActiveFormat() {
CSVFormat answer = format;
if (commentMarkerDisabled) {
answer = answer.withCommentMarker(null); // null disables the comment marker
} else if (commentMarker != null) {
answer = answer.withCommentMarker(commentMarker);
}
if (delimiter != null) {
answer = answer.withDelimiter(delimiter);
}
if (escapeDisabled) {
answer = answer.withEscape(null); // null disables the escape
} else if (escape != null) {
answer = answer.withEscape(escape);
}
if (headerDisabled) {
answer = answer.withHeader((String[]) null); // null disables the header
} else if (header != null) {
answer = answer.withHeader(header);
}
if (allowMissingColumnNames != null) {
answer = answer.withAllowMissingColumnNames(allowMissingColumnNames);
}
if (ignoreEmptyLines != null) {
answer = answer.withIgnoreEmptyLines(ignoreEmptyLines);
}
if (ignoreSurroundingSpaces != null) {
answer = answer.withIgnoreSurroundingSpaces(ignoreSurroundingSpaces);
}
if (nullStringDisabled) {
answer = answer.withNullString(null); // null disables the null string replacement
} else if (nullString != null) {
answer = answer.withNullString(nullString);
}
if (quoteDisabled) {
answer = answer.withQuote(null); // null disables quotes
} else if (quote != null) {
answer = answer.withQuote(quote);
}
if (quoteMode != null) {
answer = answer.withQuoteMode(quoteMode);
}
if (recordSeparatorDisabled) {
answer = answer.withRecordSeparator(null); // null disables the record separator
} else if (recordSeparator != null) {
answer = answer.withRecordSeparator(recordSeparator);
}
if (skipHeaderRecord != null) {
answer = answer.withSkipHeaderRecord(skipHeaderRecord);
}
return answer;
}