Package de.xima.fc.common.text.newline
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 CR
Newline is represented as a carriage return '\r'.CR_LF
Newline is represented as a carriage return followed by a line feed '\r\n'.FF
Newline is represented as a form feed '\f'.LF
Newline is represented as a line feed '\r\n'.LS
Newline is represented as a line separator ' '.NEL
Newline is represented as a next line ' ' character.PS
Newline is represented as a paragraph separator ' '.UNICODE_CR_LF
Allows any kind of newline as stipulated by the Unicode standard, uses LF when joining.UNICODE_LF
Allows any kind of newline as stipulated by the Unicode standard, uses LF when joining.VT
Newline is represented as a vertical tab ''.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Newline
value()
static StandardNewlines
valueOf(String name)
Returns the enum constant of this type with the specified name.static StandardNewlines[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 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 nameNullPointerException
- if the argument is null
-
value
public Newline value()
-
-