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

substring

substring

The substring function in XQuery extracts a portion of a string based on specified start and optional length parameters. It is useful for string manipulation tasks where specific parts of a string need to be isolated and processed.

Syntax

fn:substring(sourceString, startingLoc, length)
The following table describes the argument for this command:
Argument
Required/Optional
Description
sourceString
Required
The string from which the substring will be extracted. If the argument is an empty sequence (
()
), it is treated as an empty string.
startingLoc
Required
The position within the source string where the substring begins. Position indexing starts at 1. If this number is less than 1, the start is considered from the first character.
length
Optional
The number of characters to include in the substring. If omitted, the substring extends to the end of the source string.

Return Value

  • Returns the portion of the value of
    $sourceString
    beginning at the position indicated by the value of
    $startingLoc
    and continuing for the number of characters indicated by the value of
    $length
    . The characters returned do not extend beyond
    $sourceString
    .
  • If
    $startingLoc
    is zero or negative, only those characters in positions greater than zero are returned.
  • If the start position is beyond the end of the string, it returns an empty string.

Examples

The following table lists some sample values and return values:
SAMPLE FUNCTION
OUTPUT
fn:substring('query', 1)
query
fn:substring('query', 3)
ery
fn:substring('query', 1, 1)
q
fn:substring('query', 2, 3)
uer
fn:substring('query', 2, 850)
uery
fn:substring('query', 6, 2)
zero-length string
fn:substring('query', -2)
query
fn:substring('query', -2, 5)
qu
fn:substring('query', 1, 0)
zero-length string
fn:substring('', 1)
zero-length string
fn:substring((), 1)
zero-length string
fn:substring("Example", 0)
"Example"
fn:substring("Short", 10)
""

0 COMMENTS

We’d like to hear from you!