-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a353e0b
commit 553fc60
Showing
2 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package it.albertus.util; | ||
|
||
public enum NewLine { | ||
|
||
CR('\r'), | ||
LF('\n'), | ||
CRLF('\r', '\n'); | ||
|
||
private final char[] characters; | ||
private final String string; | ||
|
||
private NewLine(char... characters) { | ||
this.characters = characters; | ||
this.string = String.valueOf(characters); | ||
} | ||
|
||
/** | ||
* Restituisce un array di caratteri contenente la sequenza di caratteri che | ||
* rappresenta il ritorno a capo. | ||
* | ||
* @return l'array di caratteri che rappresenta il ritorno a capo. | ||
*/ | ||
public char[] getCharacters() { | ||
return characters; | ||
} | ||
|
||
/** | ||
* Restituisce una stringa contenente la sequenza di caratteri che | ||
* rappresenta il ritorno a capo. | ||
* | ||
* @return la stringa che rappresenta il ritorno a capo. | ||
*/ | ||
public String getString() { | ||
return string; | ||
} | ||
|
||
/** | ||
* Restituisce l'<b>enum</b> corrispondente al tipo di ritorno a capo | ||
* desiderato. | ||
* | ||
* @param type | ||
* una stringa tra "CR" (Macintosh), "LF" (Unix) e "CRLF" | ||
* (DOS/Windows). | ||
* @return l'<b>enum</b> corrispondente al tipo di ritorno a capo passato | ||
* come parametro. | ||
*/ | ||
public static NewLine getEnum(String type) { | ||
if (type != null && type.trim().length() != 0) { | ||
type = type.trim().toUpperCase(); | ||
for (NewLine newLine : NewLine.values()) { | ||
if (newLine.name().equals(type)) { | ||
return newLine; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
version.number=1.0.3 | ||
version.date=2015-05-27 | ||
version.number=1.0.4 | ||
version.date=2015-05-29 |