public final class CharacterConversions extends Object
Modifier and Type | Field and Description |
---|---|
static char |
CR
Unicode carriage return (0x000D).
|
static char |
LF
Unicode line feed (0x000A).
|
static char |
LS
Unicode line separator (0x2028).
|
static char |
PS
Unicode paragraph separator (0x2029).
|
Modifier and Type | Method and Description |
---|---|
static String |
lineFeedToLineSeparator(CharSequence text)
Converts line feed characters (
0x0A ) to a system default line
separator. |
static String |
lineFeedToLineSeparator(CharSequence text,
CharSequence lineSeparator)
Converts line feed characters (
0x0A ) to the specified line
separator. |
static String |
lineSeparatorToLineFeed(CharSequence text)
Converts line separators in text to line feed (
0x0A )
character. |
static String |
lineSeparatorToLineFeed(CharSequence text,
CharSequence lineSeparator)
Converts line separators in text to line feed (
0x0A )
character. |
public static final char LF
public static final char CR
public static final char LS
public static final char PS
public static String lineSeparatorToLineFeed(CharSequence text)
0x0A
)
character. It automatically detects all sorts of line separators such
as CRLF
, LF
, LS
and PS
.
The text can even contain a mixture of those separators.text
- The text to convert line seprators in. This can be null
,
in which case an empty string is returned.public static String lineSeparatorToLineFeed(CharSequence text, CharSequence lineSeparator)
0x0A
)
character. This method will only look for the lineSeparator
characters and will ignore all other characters that could possibly be
used for separating lines in the text. If you want automatic detection
of all possible line separators use CharacterConversions.lineSeparatorToLineFeed(CharSequence)
.text
- The text to convert line seprators in. This can be null
,
in which case an empty string is returned.lineSeparator
- The line separator to look for and replace.lineSeparator
s replaced by the
line feed character.public static String lineFeedToLineSeparator(CharSequence text)
0x0A
) to a system default line
separator. The line separator for your system is determined by looking
at the "line.separator" system property of your JVM.text
- The text to convert line feed characters in. Can be null
,
in which case an empty string is returned.public static String lineFeedToLineSeparator(CharSequence text, CharSequence lineSeparator)
0x0A
) to the specified line
separator.text
- The text to convert line feed characters in. Can be null
,
in which case an empty string is returned.lineSeparator
- The line separator to use as a replacement.lineSeparator
.