HOME | util Class
A static JavaScript object that defines a number of utility methods and convenience functions for string and date formatting and parsing.
Item Index
Methods
getDayString
-
index -
abbreviated
Returns the day string for the given index.
Parameters:
-
indexNumberThe index of the day. For e.g. 1 for Sunday.
-
abbreviatedBooleanSpecifies if the abbreviated string is to be returned or the entire string.
Returns:
The day string for the index.
getFormattedComponentValue
-
date -
match
Returns formatted date component.
Parameters:
-
dateObjectThe date object.
-
matchStringThe component match found in the format string.
Returns:
Formatted date component.
getFormattedComponentValue
-
cSource -
match
Returns formatted component value.
Parameters:
-
cSourceStringThe source string.
-
matchStringThe component match found in the format string.
Returns:
Formatted component value.
getMonthString
-
index -
abbreviated
Returns the month string for the given index.
Parameters:
-
indexNumberThe index of the day. For e.g. 1 for January.
-
abbreviatedBooleanSpecifies if the abbreviated string is to be returned or the entire string.
Returns:
The month string for the index.
isNullOrUndefined
-
value
Checks if the value is either null or undefined.
Parameters:
-
valueAnyThe value which is to be tested.
Returns:
True if value is null or undefined, otherwise false.
lpad
-
value -
width
Adds left pad to value.
Parameters:
-
valueNumberThe value to be left padded.
-
widthNumberThe width in characters of the final string.
Returns:
Left padded value.
printd
-
cFormat -
oDate
Returns a date using a specified format.
Parameters:
-
cFormatStringA string that is a pattern of supported substrings that are place-holders for date and time data.
-
oDateObjectA Date object to format.
Returns:
The formatted date string.
printf
-
cFormat -
[arguments]
Formats one or more arguments as a string according to a format string. It is similar to the C function of the same name.
Parameters:
-
cFormatStringThe format string to use.
-
[arguments]Any optionalThe optional arguments(s) that contain the data to be inserted in place of the % tags specified in the first parameter, the format string. The number of optional arguments must be the same as the number of % tags.
Returns:
A result string formatted as specified.
printx
-
cFormat -
cSource
Formats a source string, cSource, according to a formatting string, cFormat.
Parameters:
-
cFormatStringThe formatting string to use.
-
cSourceStringThe source string to use.
Returns:
The formatted string.
search
-
string -
searchString
Searches for a string in another string.
Parameters:
-
stringStringThe string in which the searchString is to be found.
-
searchStringStringThe search string.
Returns:
The index of where the searchString was found in the string.
validateInput
()
Boolean
private
Does input validation for printx method.
Returns:
True if input is valid, otherwise false.
validateInput
()
Boolean
private
Does input validation for printd method.
Returns:
True if input is valid, otherwise false.