Package gov.nasa.pds.citool.util
Class Utility
- java.lang.Object
-
- gov.nasa.pds.citool.util.Utility
-
public class Utility extends Object
-
-
Constructor Summary
Constructors Constructor Description Utility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
collapse(String source)
Method to remove extra spaces from the string specified by the string attributes.static String
filterString(String value)
static String
getDateTime()
Get the current date time.static boolean
isNull(String value)
Determines whether a value is null as defined by the PDS.static String
itrim(String source)
Replace multiple whitespaces between words with single blankstatic String
ltrim(String source)
Trim the string of any spaces on the left end (ie., leading spaces removed) Remove leading spaces for each line when there is multiple lines of stringstatic String
printDiff(String indent, List<DiffRecord> records)
static List<String>
removeQuotes(List<String> list)
static String
replaceChars(String strToReplace)
static String
rtrim(String source)
Trim the string of any spaces on the right end (ie., trailing spaces removed)static String
stripNewLines(String value)
static String
stripOnlyWhitespaceAndNewLine(String value)
Strips only newline characters and extra whitespaces.static String
stripWhitespace(String value)
static URL
toURL(String s)
Convert a string to a URL.static String
trimString(String value, int length)
static boolean
valueExists(String value, List<String> lists)
-
-
-
Method Detail
-
stripOnlyWhitespaceAndNewLine
public static String stripOnlyWhitespaceAndNewLine(String value)
Strips only newline characters and extra whitespaces.- Parameters:
value
- A string value.- Returns:
- The filtered value.
-
collapse
public static String collapse(String source)
Method to remove extra spaces from the string specified by the string attributes. It returns the collapsed string without any additional spaces at the beginning of the string and '\r\n' characters. Example (orignal line): OBJECT = "THIS LINE IS BAD" (collapsed): OBJECT = "THIS LINE IS BAD"
-
itrim
public static String itrim(String source)
Replace multiple whitespaces between words with single blank
-
ltrim
public static String ltrim(String source)
Trim the string of any spaces on the left end (ie., leading spaces removed) Remove leading spaces for each line when there is multiple lines of string
-
rtrim
public static String rtrim(String source)
Trim the string of any spaces on the right end (ie., trailing spaces removed)
-
isNull
public static boolean isNull(String value)
Determines whether a value is null as defined by the PDS.- Parameters:
value
- The value in question- Returns:
- true if the value is null, false otherwise.
-
toURL
public static URL toURL(String s) throws MalformedURLException
Convert a string to a URL.- Parameters:
s
- The string to convert- Returns:
- A URL of the input string
- Throws:
MalformedURLException
-
getDateTime
public static String getDateTime()
Get the current date time.- Returns:
- A date time.
-
printDiff
public static String printDiff(String indent, List<DiffRecord> records)
-
-