public final class ParsingUtils extends Object
| Constructor and Description |
|---|
ParsingUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
assertFieldHasContent(String field,
String value)
Asserts that a specified field contains a non-null, non-empty value.
|
static boolean |
fileMatchesExtension(File file,
String targetExtension)
Determine if a given file matches the target extension.
|
static String |
formatSampleText(List<String> lines,
int maxTrim)
Formats a section of sample text by removing leading whitespace
characters up to a given maximum and by flattening lines into a single
string.
|
static int |
getLeadingWhitespace(String str)
Returns the number of leading whitespace characters in a given string.
|
static int |
getMinWhitespace(List<String> lines)
Gets the minimum amount of leading whitespace in a text block.
|
static String |
trimLeadingWhitespace(String str,
int max)
Trims up to a certain number of leading whitespace characters from a
string.
|
public static boolean fileMatchesExtension(File file, String targetExtension)
file - file to checktargetExtension - target extensionpublic static String formatSampleText(List<String> lines, int maxTrim)
lines - list where each element represents an individual line of
sample textmaxTrim - maximum number of leading whitespace characters to trim from
each linepublic static int getMinWhitespace(List<String> lines)
lines - list where each element represents an individual line of
sample textpublic static int getLeadingWhitespace(String str)
str - string to checkpublic static String trimLeadingWhitespace(String str, int max)
str - string to processmax - maximum number of whitespace characters to trimCopyright © 2016. All Rights Reserved.