Class FieldModifiers

java.lang.Object
de.siegmar.fastcsv.reader.FieldModifiers

public final class FieldModifiers extends Object
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 Details

    • NOP

      public static final FieldModifier NOP
      Modifier that does not modify anything.
    • TRIM

      public static final FieldModifier TRIM
      Modifier that modifies the field value with String.trim(). Comments are not modified.
    • STRIP

      public static final FieldModifier STRIP
      Modifier that modifies the field value with String.strip(). Comments are not modified.
  • Constructor Details

    • FieldModifiers

      private FieldModifiers()
  • Method Details

    • lower

      public static FieldModifier lower(Locale locale)
      Builds modifier that modifies the field value with String.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

      public static FieldModifier upper(Locale locale)
      Builds modifier that modifies the field value with String.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.