Enables scripted content fragments to have access to useful utility methods
- Properties
- AdjustTimeZone
- AsArray
- CompareDates
- ComputeHash
- ContainsContent
- CreateError
- CreateWarning
- Describe
- FlattenHierarchy
- GetTemporaryData
- GetTimestamp
- IsMatch
- Join
- MakeList
- NewGuid
- ParseBool
- ParseDate
- ParseDouble
- ParseGuid
- ParseInt
- ParseJson
- ParseLong
- ParseTimestamp
- Replace
- Round
- Slice
- Split
- StoreTemporaryData
- ToJson
- Trim
Properties
Name | Access | Type | Description |
---|---|---|---|
CurrentDate | Read | DateTime | The current date |
CurrentUserDate | Read | DateTime | The current user date |
NewLine | Read | String | New Line Character |
Methods
AdjustTimeZone
Converts the date to new time zone. OBSOLETE in 10.1
Velocity
#set($dateTimeResponse = $core_v2_utility.AdjustTimeZone($date, $timeZoneId))
JavaScript
var dateTimeResponse = core_v2_utility.AdjustTimeZone(date, timeZoneId);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required | ||
timeZoneId | String | Time Zone Id | Required |
Returns
DateTime
AsArray
Converts an array-like enumerable list to an array
Velocity
#set($objectResponse = $core_v2_utility.AsArray($items))
JavaScript
var objectResponse = core_v2_utility.AsArray(items);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
items | IEnumerable | Items | Required |
Returns
Array of Object
CompareDates
Velocity
#set($booleanResponse = $core_v2_utility.CompareDates($date1, $comparison, $date2))
JavaScript
var booleanResponse = core_v2_utility.CompareDates(date1, comparison, date2);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date1 | DateTime | Date 1 | Required | ||
comparison | String | The comparison to make between the dates | Required | EarlierThan, EarlierThanOrEqualTo, EqualTo, LaterThan, LaterThanOrEqual, NotEqualTo | |
date2 | DateTime | Date 2 | Required |
Returns
Boolean
ComputeHash
ComputeHash Overload 1
Velocity
#set($stringResponse = $core_v2_utility.ComputeHash($value, $algorithm))
JavaScript
var stringResponse = core_v2_utility.ComputeHash(value, algorithm);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
value | String | The value to hash. | Required | ||
algorithm | String | The algorithm to use to generate the hash. | Required | SHA1, SHA256 |
ComputeHash Overload 2
Velocity
#set($stringResponse = $core_v2_utility.ComputeHash($value, $algorithm, "%{ HashEncoding = $hashEncodingArg, Key = $keyArg, KeyEncoding = $keyEncodingArg, ValueEncoding = $valueEncodingArg }"))
JavaScript
var stringResponse = core_v2_utility.ComputeHash(value, algorithm, { HashEncoding: hashEncodingArg, Key: keyArg, KeyEncoding: keyEncodingArg, ValueEncoding: valueEncodingArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
value | String | The value to hash. | Required | ||
algorithm | String | The algorithm to use to generate the hash. | Required | SHA1, SHA256 | |
options | Options | Set of optional parameters including: | Required | ||
HashEncoding | String | Encoding of the resulting hash. | Optional | Base64 | Base64, Hex |
Key | String | Optional hashing key. When specified, the key will be used to generate an HMAC hash using the provided algorithm. | Optional | ||
KeyEncoding | String | Encoding of the hashing key. | Optional | Base64 | Base64, Hex |
ValueEncoding | String | Optional encoding of the value. If not specified, the value will be interpreted as a UTF8 value. | Optional | Base64, Hex |
Returns
String
ContainsContent
Velocity
#set($booleanResponse = $core_v2_utility.ContainsContent($html))
JavaScript
var booleanResponse = core_v2_utility.ContainsContent(html);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
html | String | Html | Required |
Returns
Boolean
CreateError
Creates a new Error entity
Velocity
#set($errorResponse = $core_v2_utility.CreateError($type, $message))
JavaScript
var errorResponse = core_v2_utility.CreateError(type, message);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
type | String | Type | Required | ||
message | String | Message | Required |
Returns
CreateWarning
Creates a new Warning entity
Velocity
#set($warningResponse = $core_v2_utility.CreateWarning($type, $message))
JavaScript
var warningResponse = core_v2_utility.CreateWarning(type, message);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
type | String | Type | Required | ||
message | String | Message | Required |
Returns
Describe
Describe Overload 1
Returns debug information about a given object, recursing all properties
Velocity
#set($stringResponse = $core_v2_utility.Describe($o))
JavaScript
var stringResponse = core_v2_utility.Describe(o);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
o | Object | O | Required |
Describe Overload 2
Returns debug information about a given object, recursing all properties
Velocity
#set($stringResponse = $core_v2_utility.Describe($item, "%{ Depth = $depthArg, Format = $formatArg }"))
JavaScript
var stringResponse = core_v2_utility.Describe(item, { Depth: depthArg, Format: formatArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
item | Object | Item | Required | ||
options | Options | Set of optional parameters including: | Required | ||
Depth | Int32 | Depth of traversal | Optional | 2 | |
Format | String | Format | Optional | list | list, text |
Returns
String
FlattenHierarchy
FlattenHierarchy Overload 1
Flattens a nested hierarchy of objects
Velocity
#set($iListResponse = $core_v2_utility.FlattenHierarchy($hierarchy, $recursiveProperty))
JavaScript
var iListResponse = core_v2_utility.FlattenHierarchy(hierarchy, recursiveProperty);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
hierarchy | IEnumerable | Hierarchy | Required | ||
recursiveProperty | String | Recursive Property | Required |
FlattenHierarchy Overload 2
Flattens a nested hierarchy of objects
Velocity
#set($iListResponse = $core_v2_utility.FlattenHierarchy($hierarchy, $recursiveProperty, "%{ ExpandToChildProperty = $expandToChildPropertyArg, ExpandToChildValue = $expandToChildValueArg, ExpandToLevel = $expandToLevelArg, HiddenProperty = $hiddenPropertyArg }"))
JavaScript
var iListResponse = core_v2_utility.FlattenHierarchy(hierarchy, recursiveProperty, { ExpandToChildProperty: expandToChildPropertyArg, ExpandToChildValue: expandToChildValueArg, ExpandToLevel: expandToLevelArg, HiddenProperty: hiddenPropertyArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
hierarchy | IEnumerable | Hierarchy | Required | ||
recursiveProperty | String | Recursive Property | Required | ||
options | Options | Set of optional parameters including: | Required | ||
ExpandToChildProperty | String | Expand To Child Property | Optional | ||
ExpandToChildValue | String | Expand To Child Value | Optional | ||
ExpandToLevel | Int32 | Expand To Level | Optional | ||
HiddenProperty | String | Hidden Property | Optional |
Returns
IList of FlattenedHierarchyItem
GetTemporaryData
Retrieves temporary data
Velocity
#set($stringResponse = $core_v2_utility.GetTemporaryData($key))
JavaScript
var stringResponse = core_v2_utility.GetTemporaryData(key);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
key | String | Key | Required |
Returns
String
GetTimestamp
Creates an timestamp representation of the date supplied.
Velocity
#set($stringResponse = $core_v2_utility.GetTimestamp($date))
JavaScript
var stringResponse = core_v2_utility.GetTimestamp(date);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | DateTime | Date | Required |
Returns
String
IsMatch
IsMatch Overload 1
Tests a string against a regular expression pattern
Velocity
#set($booleanResponse = $core_v2_utility.IsMatch($input, $pattern))
JavaScript
var booleanResponse = core_v2_utility.IsMatch(input, pattern);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required | ||
pattern | String | Pattern | Required |
IsMatch Overload 2
Tests a string against a regular expression pattern
Velocity
#set($booleanResponse = $core_v2_utility.IsMatch($input, $pattern, "%{ RegexOptions = $regexOptionsArg }"))
JavaScript
var booleanResponse = core_v2_utility.IsMatch(input, pattern, { RegexOptions: regexOptionsArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required | ||
pattern | String | Pattern | Required | ||
options | Options | Set of optional parameters including: | Required | ||
RegexOptions | IList of String | List of options. | Optional | Compiled, CultureInvariant, ECMAScript, ExplicitCapture, IgnoreCase, IgnorePatternWhitespace, Multiline, None, RightToLeft, Singleline |
Returns
Boolean
Join
Joins a list of items into a single string
Velocity
#set($stringResponse = $core_v2_utility.Join($separator, $items))
JavaScript
var stringResponse = core_v2_utility.Join(separator, items);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
separator | String | Separator | Required | ||
items | IList of String | Items | Required |
Returns
String
MakeList
Converts an array of strings into an IList of strings
Velocity
#set($iListResponse = $core_v2_utility.MakeList($items))
JavaScript
var iListResponse = core_v2_utility.MakeList(items);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
items | Array of String | Items | Required |
Returns
IList of String
NewGuid
Creates a new guid.
Velocity
#set($guidResponse = $core_v2_utility.NewGuid())
JavaScript
var guidResponse = core_v2_utility.NewGuid();
Returns
Guid
ParseBool
Converts a string to a bool. false if unparseable
Velocity
#set($booleanResponse = $core_v2_utility.ParseBool($boolean))
JavaScript
var booleanResponse = core_v2_utility.ParseBool(boolean);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
boolean | String | Boolean | Required |
Returns
Boolean
ParseDate
ParseDate Overload 1
Converts numerically-formatted year, month, and date strings into a DateTime
Velocity
#set($dateTimeResponse = $core_v2_utility.ParseDate($year, $month, $day))
JavaScript
var dateTimeResponse = core_v2_utility.ParseDate(year, month, day);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
year | String | Year | Required | ||
month | String | Month | Required | ||
day | String | Day | Required |
ParseDate Overload 2
Converts numerically-formatted year, month, date, hour, and minute strings into a DateTime
Velocity
#set($dateTimeResponse = $core_v2_utility.ParseDate($year, $month, $day, $hour, $minute))
JavaScript
var dateTimeResponse = core_v2_utility.ParseDate(year, month, day, hour, minute);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
year | String | Year | Required | ||
month | String | Month | Required | ||
day | String | Day | Required | ||
hour | String | Hour | Required | ||
minute | String | Minute | Required |
ParseDate Overload 3
Converts a string to a DateTime. Minimum Date if unparseable.
Velocity
#set($dateTimeResponse = $core_v2_utility.ParseDate($date))
JavaScript
var dateTimeResponse = core_v2_utility.ParseDate(date);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
date | String | Date | Required |
Returns
DateTime
ParseDouble
Converts a string to a double. 0 if unparseable
Velocity
#set($doubleResponse = $core_v2_utility.ParseDouble($input))
JavaScript
var doubleResponse = core_v2_utility.ParseDouble(input);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required |
Returns
Double
ParseGuid
Converts a string to a guid. Empty guid if unparseable
Velocity
#set($guidResponse = $core_v2_utility.ParseGuid($guid))
JavaScript
var guidResponse = core_v2_utility.ParseGuid(guid);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
guid | String | Guid | Required |
Returns
Guid
ParseInt
Converts a string to an integer. 0 if unparseable
Velocity
#set($int32Response = $core_v2_utility.ParseInt($input))
JavaScript
var int32Response = core_v2_utility.ParseInt(input);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required |
Returns
Int32
ParseJson
Parses a JSON object
Velocity
#set($objectResponse = $core_v2_utility.ParseJson($json))
JavaScript
var objectResponse = core_v2_utility.ParseJson(json);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
json | String | Json | Required |
Returns
Object
ParseLong
Converts a string to a long. 0 if unparseable
Velocity
#set($int64Response = $core_v2_utility.ParseLong($input))
JavaScript
var int64Response = core_v2_utility.ParseLong(input);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required |
Returns
Int64
ParseTimestamp
Converts the timestamp string to DateTime.
Velocity
#set($dateTimeResponse = $core_v2_utility.ParseTimestamp($timestamp))
JavaScript
var dateTimeResponse = core_v2_utility.ParseTimestamp(timestamp);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
timestamp | String | Timestamp | Required |
Returns
DateTime
Replace
Replace Overload 1
Replaces all parts of a string matching a regular expression pattern with a replacement
Velocity
#set($stringResponse = $core_v2_utility.Replace($input, $pattern, $replacement))
JavaScript
var stringResponse = core_v2_utility.Replace(input, pattern, replacement);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required | ||
pattern | String | Pattern | Required | ||
replacement | String | Replacement | Required |
Replace Overload 2
Replaces all parts of a string matching a regular expression pattern with a replacement
Velocity
#set($stringResponse = $core_v2_utility.Replace($input, $pattern, $replacement, "%{ RegexOptions = $regexOptionsArg }"))
JavaScript
var stringResponse = core_v2_utility.Replace(input, pattern, replacement, { RegexOptions: regexOptionsArg });
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required | ||
pattern | String | Pattern | Required | ||
replacement | String | Replacement | Required | ||
options | Options | Set of optional parameters including: | Required | ||
RegexOptions | IList of String | List of options. | Optional | Compiled, CultureInvariant, ECMAScript, ExplicitCapture, IgnoreCase, IgnorePatternWhitespace, Multiline, None, RightToLeft, Singleline |
Returns
String
Round
Rounds a double-precision value to the nearest integer
Velocity
#set($int32Response = $core_v2_utility.Round($input))
JavaScript
var int32Response = core_v2_utility.Round(input);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | Double | Input | Required |
Returns
Int32
Slice
Returns a subset of a list of strings
Velocity
#set($iListResponse = $core_v2_utility.Slice($array, $startIndex, $length))
JavaScript
var iListResponse = core_v2_utility.Slice(array, startIndex, length);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
array | IList of String | Array | Required | ||
startIndex | Int32 | Zero-based index to begin slice | Required | ||
length | Int32 | Length of slice | Required |
Returns
IList of String
Split
Split Overload 1
Splits a string into separate items
Velocity
#set($iListResponse = $core_v2_utility.Split($separator, $joined))
JavaScript
var iListResponse = core_v2_utility.Split(separator, joined);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
separator | String | Separator | Required | ||
joined | String | Joined | Required |
Split Overload 2
Splits a string into separate items
Velocity
#set($iListResponse = $core_v2_utility.Split($separator, $joined, $count))
JavaScript
var iListResponse = core_v2_utility.Split(separator, joined, count);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
separator | String | Separator | Required | ||
joined | String | Joined | Required | ||
count | Int32 | Count | Required |
Returns
IList of String
StoreTemporaryData
Stores temporary data
Velocity
#set($stringResponse = $core_v2_utility.StoreTemporaryData($data))
JavaScript
var stringResponse = core_v2_utility.StoreTemporaryData(data);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
data | String | Data | Required |
Returns
String
ToJson
Serializes an object to JSON
Velocity
#set($stringResponse = $core_v2_utility.ToJson($value))
JavaScript
var stringResponse = core_v2_utility.ToJson(value);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
value | Object | Value | Required |
Returns
String
Trim
Trims whitespace around a string
Velocity
#set($stringResponse = $core_v2_utility.Trim($input))
JavaScript
var stringResponse = core_v2_utility.Trim(input);
Parameters
Name | Type | Description | Required | Default | Options |
---|---|---|---|---|---|
input | String | Input | Required |
Returns
String