Package gov.usgs.util
Class StringUtils
java.lang.Object
gov.usgs.util.StringUtils
String parsing and utility functions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringencodeAsUtf8(String value) static DoubleNo Exception Double parsing method.static FloatNo Exception Float parsing method.static IntegergetInteger(String value) No Exception Integer parsing method.static LongNo Exception Long parsing method.static StringJoin objects in a list using the specified delimiter.Split a string into a list of strings using the specified delimiter.
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
encodeAsUtf8
- Parameters:
value- value to encode- Returns:
- Utf8 encoded string
- Throws:
UnsupportedEncodingException- if character encoding is not supported
-
getDouble
No Exception Double parsing method.- Parameters:
value- string to get double from- Returns:
- null on error, otherwise Double value.
-
getFloat
No Exception Float parsing method.- Parameters:
value- string to get float from- Returns:
- null on error, otherwise Float value.
-
getInteger
No Exception Integer parsing method.- Parameters:
value- string to get integer from- Returns:
- null on error, otherwise Integer value.
-
getLong
No Exception Long parsing method.- Parameters:
value- string to get long from- Returns:
- null on error, otherwise Integer value.
-
join
Join objects in a list using the specified delimiter. The objects toString method is used to get a string value.- Parameters:
delimiter- string to insert between list items.list- items to join.- Returns:
- string containing delimiter delimited list items.
-
split
Split a string into a list of strings using the specified delimiter. The intrinsic String.split method is used and elements of the returned String array (if any) are added to a list.- Parameters:
toSplit- string to split.delimiter- string used to separate items in toSplit- Returns:
- a list containing items.
-