Package com.xero.api
Class StringUtil
- java.lang.Object
-
- com.xero.api.StringUtil
-
public class StringUtil extends Object
StringUtil has helper methods for String and Date conversions
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancontainsIgnoreCase(String[] array, String value)Check if the given array contains the given value (with case-insensitive comparison).org.threeten.bp.LocalDateconvertStringToDate(String date)Convert string to dateorg.threeten.bp.LocalDateTimeconvertStringToLocalDateTime(String date)Convert string to datetimeorg.threeten.bp.OffsetDateTimeconvertStringToOffsetDateTime(String date)Convert string to datetimestatic Stringjoin(String[] array, String separator)Join an array of strings with the given separator.
-
-
-
Method Detail
-
containsIgnoreCase
public static boolean containsIgnoreCase(String[] array, String value)
Check if the given array contains the given value (with case-insensitive comparison).- Parameters:
array- The arrayvalue- The value to search- Returns:
- true if the array contains the value
-
join
public static String join(String[] array, String separator)
Join an array of strings with the given separator.Note: This might be replaced by utility method from commons-lang or guava someday if one of those libraries is added as dependency.
- Parameters:
array- The array of stringsseparator- The separator- Returns:
- the resulting string
-
convertStringToDate
public org.threeten.bp.LocalDate convertStringToDate(String date) throws IOException
Convert string to date- Parameters:
date- String is a date in MS DateFormat- Returns:
- LocalDate a standard date
- Throws:
IOException- thown if string pattern matching and formatting fails
-
convertStringToOffsetDateTime
public org.threeten.bp.OffsetDateTime convertStringToOffsetDateTime(String date) throws IOException
Convert string to datetime- Parameters:
date- String is a date in MS DateFormat- Returns:
- OffsetDateTime an offset date time set to UTC
- Throws:
IOException- thown if string pattern matching and formatting fails
-
convertStringToLocalDateTime
public org.threeten.bp.LocalDateTime convertStringToLocalDateTime(String date) throws IOException
Convert string to datetime- Parameters:
date- String is a date in MS DateFormat- Returns:
- LocalDateTime an local date time
- Throws:
IOException- thown if string pattern matching and formatting fails
-
-