Package com.api.jsonata4java.expressions
Class JS4JUtils
- java.lang.Object
-
- com.api.jsonata4java.expressions.JS4JUtils
-
- All Implemented Interfaces:
Serializable
public class JS4JUtils extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ints_iDayMillisecondsstatic ints_iHourMillisecondsstatic ints_iMinuteMilliseconds
-
Constructor Summary
Constructors Constructor Description JS4JUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intconvertTimeZoneToMilliseconds(String strTimeZone)Converts a timezone of the format +/-hhmm to millisecondsstatic StringpadRight(int iIn, int iWidth, char cPad)Helper method to create strings of the form "nn000".static StringpadRight(long lIn, int iWidth, char cPad)Helper method to create strings of the form "nn000".static StringpadRight(String strInput, int iMax, char cPadChar)Creates a new String padded on its right side with the supplied pad character guaranteed to be the supplied length.
-
-
-
Field Detail
-
s_iDayMilliseconds
public static final int s_iDayMilliseconds
- See Also:
- Constant Field Values
-
s_iHourMilliseconds
public static final int s_iHourMilliseconds
- See Also:
- Constant Field Values
-
s_iMinuteMilliseconds
public static final int s_iMinuteMilliseconds
- See Also:
- Constant Field Values
-
-
Method Detail
-
convertTimeZoneToMilliseconds
public static int convertTimeZoneToMilliseconds(String strTimeZone)
Converts a timezone of the format +/-hhmm to milliseconds- Parameters:
strTimeZone- timezone offset from Greenwich Mean Time (GMT) for example "-0500" is Eastern Standard Time, "-0400" is Eastern Daylight Time, "+0000" is Greenwich Mean Time, and "+0100" is the offset for Europe/Paris.- Returns:
- milliseconds from Greenwich Mean Time
-
padRight
public static String padRight(long lIn, int iWidth, char cPad)
Helper method to create strings of the form "nn000".- Parameters:
lIn- long value to be right justified with leading characters in the returned String.iWidth- integer value of the width of the returned String.cPad- character value to be used to pad the right portion of the returned String to make it as wide as the specified iWidth parameter. For example, calling toRightPaddedString(iNum,4,'0') would result in "4500" if iNum == 45, or "4000" if iNum == 4.- Returns:
- String containing the right justified value, padded to the specified with the specified pad character.
-
padRight
public static String padRight(int iIn, int iWidth, char cPad)
Helper method to create strings of the form "nn000".- Parameters:
iIn- integer value to be right justified with leading characters in the returned String.iWidth- integer value of the width of the returned String.cPad- character value to be used to pad the right portion of the returned String to make it as wide as the specified iWidth parameter. For example, calling toRightPaddedString(iNum,4,'0') would result in "4500" if iNum == 45, or "4000" if iNum == 4.- Returns:
- String containing the right justified value, padded to the specified with the specified pad character.
-
padRight
public static String padRight(String strInput, int iMax, char cPadChar)
Creates a new String padded on its right side with the supplied pad character guaranteed to be the supplied length. If the supplied length is less than or equal to the length of the supplied string, the supplied string is returned. If the supplied string is null, a new string is returned filled with the supplied pad character that is as long as the supplied length.- Parameters:
strInput-iMax-cPadChar-- Returns:
- formatted string with padding
-
-