java.lang.Object
de.siegmar.fastcsv.reader.FieldModifiers
Provides some common
FieldModifier
implementations.
Example usage:
var modifier = FieldModifiers.TRIM.andThen(FieldModifiers.upper(Locale.ENGLISH));
var fields = CsvReader.builder()
.build(new CsvRecordHandler(modifier, " foo , bar"))
.stream()
.collect(Collectors.toList());
// fields would be: "FOO" and "BAR"
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FieldModifier
Modifier that does not modify anything.static final FieldModifier
Modifier that modifies the field value withString.strip()
.static final FieldModifier
Modifier that modifies the field value withString.trim()
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FieldModifier
Builds modifier that modifies the field value withString.toLowerCase(Locale)
.static FieldModifier
Builds modifier that modifies the field value withString.toUpperCase(Locale)
.
-
Field Details
-
NOP
Modifier that does not modify anything. -
TRIM
Modifier that modifies the field value withString.trim()
. Comments are not modified. -
STRIP
Modifier that modifies the field value withString.strip()
. Comments are not modified.
-
-
Constructor Details
-
FieldModifiers
private FieldModifiers()
-
-
Method Details
-
lower
Builds modifier that modifies the field value withString.toLowerCase(Locale)
. Comments are not modified.- Parameters:
locale
- use the case transformation rules for this locale- Returns:
- a new field modifier that converts the input to lower-case.
-
upper
Builds modifier that modifies the field value withString.toUpperCase(Locale)
. Comments are not modified.- Parameters:
locale
- use the case transformation rules for this locale- Returns:
- a new field modifier that converts the input to upper-case.
-