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

string-length

string-length

The string-length function in XQuery is used to determine the number of characters in a given string including the leading and trailing whitespace characters. It is particularly useful for tasks that require string validation or manipulation, where the size of the string is relevant.

Syntax

fn:string-length(arg)
The following table describes the argument for this command:
Argument
Required/Optional
Description
arg
Optional
The input string whose length you want to determine. If the argument is omitted, the function defaults to using the context item; if the context item is not a string, a type error is raised. If the argument is an empty sequence (
()
), it is treated as an empty string.

Return Value

Returns an integer equal to the length in characters of the value of
$arg
. For an empty string or empty sequence, it returns
0
.

Examples

The following table lists some sample values and return values:
SAMPLE FUNCTION
OUTPUT
fn:string-length('query')
5
fn:string-length(' query ')
9
fn:string-length(normalize-space(' query '))
5
fn:string-length('xml query')
9
fn:string-length('')
0
fn:string-length(())
0
fn:string-length("Hello, World!")
13
fn:string-length(" \t")
4

0 COMMENTS

We’d like to hear from you!