Enum StandardNewlines

java.lang.Object
java.lang.Enum<StandardNewlines>
de.xima.fc.common.text.newline.StandardNewlines
All Implemented Interfaces:
Serializable, Comparable<StandardNewlines>

public enum StandardNewlines extends Enum<StandardNewlines>
Types of common newlines.

For example, to split a string by line feeds, trimming whitespace and removing blank lines:

 List<String> lines = StandardNewlines.LF.value()
   .asTerminator()
   .map(String::trim)
   .filter(String::isEmpty)
   .splitToList("a\n\nb");
Since:
8.2.0
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Newline is represented as a carriage return '\r'.
    Newline is represented as a carriage return followed by a line feed '\r\n'.
    Newline is represented as a form feed '\f'.
    Newline is represented as a line feed '\r\n'.
    Newline is represented as a line separator '
'.
    Newline is represented as a next line '…' character.
    Newline is represented as a paragraph separator '
    Allows any kind of newline as stipulated by the Unicode standard, uses LF when joining.
    Allows any kind of newline as stipulated by the Unicode standard, uses LF when joining.
    Newline is represented as a vertical tab ' '.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • UNICODE_LF

      public static final StandardNewlines UNICODE_LF
      Allows any kind of newline as stipulated by the Unicode standard, uses LF when joining.
    • UNICODE_CR_LF

      public static final StandardNewlines UNICODE_CR_LF
      Allows any kind of newline as stipulated by the Unicode standard, uses LF when joining.
    • CR

      public static final StandardNewlines CR
      Newline is represented as a carriage return '\r'. Used by Mac OS 9 (and lower).
    • CR_LF

      public static final StandardNewlines CR_LF
      Newline is represented as a carriage return followed by a line feed '\r\n'. Used by Windows.
    • FF

      public static final StandardNewlines FF
      Newline is represented as a form feed '\f'. Used by printers.
    • LF

      public static final StandardNewlines LF
      Newline is represented as a line feed '\r\n'. Used by Unix.
    • VT

      public static final StandardNewlines VT
      Newline is represented as a vertical tab ' '. Allowed by Unicode.
    • NEL

      public static final StandardNewlines NEL
      Newline is represented as a next line '…' character.
    • LS

      public static final StandardNewlines LS
      Newline is represented as a line separator '
'.
    • PS

      public static final StandardNewlines PS
      Newline is represented as a paragraph separator '
'.
  • Method Details

    • values

      public static StandardNewlines[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static StandardNewlines valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • value

      public Newline value()