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:
-
index
NumberThe index of the day. For e.g. 1 for Sunday.
-
abbreviated
BooleanSpecifies 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:
-
date
ObjectThe date object.
-
match
StringThe component match found in the format string.
Returns:
Formatted date component.
getFormattedComponentValue
-
cSource
-
match
Returns formatted component value.
Parameters:
-
cSource
StringThe source string.
-
match
StringThe component match found in the format string.
Returns:
Formatted component value.
getMonthString
-
index
-
abbreviated
Returns the month string for the given index.
Parameters:
-
index
NumberThe index of the day. For e.g. 1 for January.
-
abbreviated
BooleanSpecifies 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:
-
value
AnyThe 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:
-
value
NumberThe value to be left padded.
-
width
NumberThe width in characters of the final string.
Returns:
Left padded value.
printd
-
cFormat
-
oDate
Returns a date using a specified format.
Parameters:
-
cFormat
StringA string that is a pattern of supported substrings that are place-holders for date and time data.
-
oDate
ObjectA 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:
-
cFormat
StringThe 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:
-
cFormat
StringThe formatting string to use.
-
cSource
StringThe source string to use.
Returns:
The formatted string.
search
-
string
-
searchString
Searches for a string in another string.
Parameters:
-
string
StringThe string in which the searchString is to be found.
-
searchString
StringThe 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.