Products Downloads


French version


 

This function returns "true" if a value belongs to an interval, "false" if not.

The supported types are String/Number/Date/Time/Date-time.

An interval is a sequence of two values of the same type: the first value represents the lower bound and the second the upper bound. A value is contained in an interval if:

Lower bound <= value <= upper bound

When the value and interval type is String, the comparison mode is lexicographic. The "opts" parameter can be used to define a comparison using a collation enabling two character strings to be compared according to a given language.

 

Parameters

String/Number/Date/Time/Date-time sequence

Interval

Interval to test

Mandatory

String/Number/Date/Time/Date-time

inOutVal

Value to test

Mandatory

Hash

opts

Definition of dependency options This object can have the following attributes:

  • "stringComp": alphanumeric string. Used to define the comparison mode for two String-type values. Two possible values:
      • "lexico": lexicographic comparison (by default),
      • "localeBased": comparison using a collation.
  • "collator": if "stringComp" is "localeBased", this attribute describes the collation used. By default, the collation is associated with the template execution locale. By default, the "strength" and "decomposition" attributes have values which depend on the locale. The collation is a hash object with the following attributes:
      • "locale": string in IETF BCP 47 format identifying a locale for the comparison,
      • "strength": string representing the strength of the collation to determine the level of difference considered as significant in the comparisons. Five values are provided: "identical", "primary", "secondary", "tertiary" and "quaternary",
      • "decomposition": string representing the collation decomposition mode. It determines the processing of Unicode combining characters. Setting the decomposition mode enables the user to choose between a quicker and fuller classification behavior. Three values are provided: "no_decomposition", "canonical_decomposition" and "full_decomposition"

Optional.

 


For example

<#assign holiday = ["2018-05-10"?date.xs, "2018-06-10"?date.xs] />
<#if hardisCore.intervalContains (holiday, .now?date)>
I'll be back soon!
</#if>

↑ Top of page