Package org.lifstools.jgoslin.domain
Klasse StringFunctions
java.lang.Object
org.lifstools.jgoslin.domain.StringFunctions
Utility methods for strings and grammars.
- Autor:
- Dominik Kopczynski, Nils Hoffmann
-
Feldübersicht
Felder -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic StringgetResourceAsString(String resourcePath) Read the provided resource path and return it as a string.static StringgetResourceAsString(org.springframework.core.io.Resource resource) Read the provided resource and return it as a string.getResourceAsStringList(String resourcePath) Read the provided resource path, which is converted to aClassPathResourceand split it at default new line characters into a list for each line.getResourceAsStringList(org.springframework.core.io.Resource resource) Read the provided resource and split it at default new line characters into a list for each line.splitString(String text) Split the provided text atDEFAULT_SPLITas separator, usingDEFAULT_QUOTEas the default quotation char.splitString(String text, char separator, char quote) Split the provided text at separator, respecting the quote char to not split in between quoted parts.splitString(String text, char separator, char quote, boolean withEmpty) Split the provided text at separator, respecting the quote char to not split in between quoted parts.static String
-
Felddetails
-
DEFAULT_QUOTE
public static char DEFAULT_QUOTE -
DEFAULT_SPLIT
public static char DEFAULT_SPLIT
-
-
Methodendetails
-
strip
-
splitString
Split the provided text atDEFAULT_SPLITas separator, usingDEFAULT_QUOTEas the default quotation char.- Parameter:
text- the text to split- Gibt zurück:
- the split string as a list
-
splitString
Split the provided text at separator, respecting the quote char to not split in between quoted parts.- Parameter:
text- the text to splitseparator- the separator to split atquote- the quotation character- Gibt zurück:
- the split string as a list
-
splitString
public static ArrayList<String> splitString(String text, char separator, char quote, boolean withEmpty) Split the provided text at separator, respecting the quote char to not split in between quoted parts. Optionally allow empty / whitespace at the end.- Parameter:
text- the text to splitseparator- the separator to split atquote- the quotation characterwithEmpty- if true, allow empty parts- Gibt zurück:
- the split string as a list
-
getResourceAsStringList
Read the provided resource and split it at default new line characters into a list for each line.- Parameter:
resource- the resource to read- Gibt zurück:
- a list of line strings
-
getResourceAsStringList
Read the provided resource path, which is converted to aClassPathResourceand split it at default new line characters into a list for each line.- Parameter:
resourcePath- the resource path to read from- Gibt zurück:
- a list of line strings
-
getResourceAsString
Read the provided resource and return it as a string.- Parameter:
resource- the resource to read- Gibt zurück:
- the resource content as a string
-
getResourceAsString
Read the provided resource path and return it as a string.- Parameter:
resourcePath- the resource path to read from- Gibt zurück:
- the resource content as a string
-