Enum 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 Detail

      • 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.
    • Method Detail

      • values

        public static StandardNewlines[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (StandardNewlines c : StandardNewlines.values())
            System.out.println(c);
        
        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