Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Table of Contents

Search

  1. Preface
  2. Understanding Data Types and Field Properties
  3. Designing Processes
  4. Using and Displaying Data
  5. Designing Guides
  6. Designing Process Objects
  7. Designing Service Connectors
  8. Using App Connections
  9. System Services, Listeners and Connectors
  10. Designing Human Tasks

Design

Design

contains

contains

The contains function in XQuery is used to determine whether one string contains another substring. This function determines if the main string contains at least one occurrence of the specified substring. It evaluates to a boolean value indicating the presence or absence of a substring within a larger string.

Syntax

fn:contains(arg1, arg2, collation)
The following table describes the argument for this command:
Argument
Required/Optional
Description
arg1
Required
The main string to check for the presence of another substring. If it is
empty-sequence()
, it is treated as an empty string.
arg2
Required
The substring to find within
$arg1
. This is the substring you are searching for. If it is
empty-sequence()
, it is treated as an empty string.
collation
Optional
A URI that specifies the collation to be used when comparing strings. Collations define locale-specific rules for string comparison. If omitted, the default collation is used.

Return Value

  • Returns a boolean value indicating whether at least one sequence of collation units in
    $arg1
    minimally matches the collation units in
    $arg2
    , including matches at the beginning or end, as determined by the specified or default collation.
  • Returns
    true
    if
    $arg2
    is found within
    $arg1
    .
  • Returns
    false
    if
    $arg2
    is not found within
    $arg1
    .
  • Returns
    false
    if either
    $arg1
    or
    $arg2
    is the empty sequence
    ()
    .
  • If
    $collation
    is provided, the substring search uses the specified collation rules.
  • If invalid collation URI is provided, an error is raised.

Examples

The following table lists some sample values and return values:
SAMPLE FUNCTION
OUTPUT
fn:contains('query', 'e')
true
fn:contains('query', 'ery')
true
fn:contains('query', 'query')
true
fn:contains("Hello", "hel")
false
fn:contains('query', 'x')
false
fn:contains('query', '')
true
fn:contains('query', ())
true
fn:contains( (), 'q')
false

Additional Notes

  • Case-sensitive by default unless a case-insensitive collation is specified.
  • Used to filter XML nodes containing a substring inside element text or attribute values.
  • Optional collation supports linguistic comparisons and internationalization.
  • Handles empty inputs gracefully, returning false.

0 COMMENTS

We’d like to hear from you!