bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Building Queries and Data Views

 Previous Next Contents Index View as PDF  

String Functions

Strings from a character set may need to be sorted differently for different applications. You must consider the sort order when you invoke string comparisons. Some string functions will require understanding of the default sort order and any other special collation. For more information, see the Character Model for the World Wide Web 1.0. The following string functions are available:

xf:compare

Returns -1, 0, or 1, depending on whether the value of Parameter1 is less than (-1), equal to (0), or greater than (1)the value of Parameter2.

Data Types

Notes

If either argument is an empty list, the result is an empty list.

Liquid Data generates an error if either parameter is not a string.

XQuery Specification Compliance

Liquid Data does not support the xf:compare format that accepts collations.

Examples

 


xf:concat

Returns a string that concatenates Parameter1 with Parameter2.

Data Types

Notes

The result string may not reflect Unicode or other W3C normalization.

Returns an empty string if the function has no arguments. If any argument is an empty list, it is treated as an empty string.

Liquid Data generates an error if either parameter is not a string.

XQuery Specification Compliance

Liquid Data does not support a variable number of parameters to be concatenated. Choose only two strings to concatenate with each operation.

Examples

 


xf:contains

Returns a boolean value of true or false indicating whether Parameter1 contains a string that is equal to Parameter2 at the beginning, at the end, or anywhere within Parameter1.

Data Types

Notes

If the value of Parameter2 is a zero-length string, the function returns true. If the value of Parameter1 is a zero-length string and the value of Parameter2 is not a zero-length string, the function returns false.

If the value of Parameter1 or Parameter2 is an empty list, the function returns an empty list.

Liquid Data generates an error if either parameter is not a string.

XQuery Specification Compliance

Liquid Data does not support the xf:contains format that accepts collations.

Examples

 


xf:ends-with

Returns a boolean value or true or false indicating whether Parameter1 ends with a string that is equal to Parameter2.

Data Types

Notes

If Parameter2 is a zero-length string, then the function returns true. If Parameter1 is a zero-length string and Parameter2 is not a zero-length string, the function returns false.

If Parameter1 or Parameter2 is an empty list, the function returns an empty list.

Liquid Data generates an error if either parameter is not a string.

XQuery Specification Compliance

Liquid Data does not support the xf:ends-with format that accepts collations.

Examples

 


xf:lower-case

Returns the value of the input string after translating every uppercase letter to its corresponding lower-case value.

Data Types

Notes

Every uppercase letter that does not have a lower-case corresponding value and every character that is not an uppercase letter appears in the output in its original form.

If the source value is an empty list, the function returns an empty list.

XQuery Specification Compliance

Conforms to the current specification.

Examples

 


xf:starts-with

Returns a boolean value or true or false indicating whether Parameter1 starts with a string that is equal to Parameter2.

Data Types

Notes

If Parameter2 is a zero-length string, then the function returns true. If Parameter1 is a zero-length string and tParameter2 is not a zero-length string, the function returns false.

If Parameter1 or Parameter2 is an empty list, the function returns an empty list.

Liquid Data generates an error if either parameter is not a string.

XQuery Specification Compliance

Liquid Data does not support the xf:ends-with format that accepts collations.

Examples

 


xf:string-length

Returns an integer equal to the number of characters in the input source string.

Data Types

Notes

If the source value is an empty list, the function returns an empty list.

Liquid Data generates an error if either parameter is not a string.

XQuery Specification Compliance

Examples

 


xf:substring (format1)

Returns that part of the Parameter1 source string from the starting location specified by Parameter2.

Data Types

Notes

If the starting location is a negative value, or greater than the length of source string, an error occurs.

The first character of a string is located at position 1 (not position 0).

If Parameter1 or Parameter2 is an empty list, the function returns an empty list.

If you omit Parameter3, the function returns characters up to the end of the source string.

Liquid Data generates an error if Parameter1 is not a string or if the starting location is less than 1.

XQuery Specification Compliance

 


xf:substring (format 2)

Returns that part of the Parameter1 source string from the starting location specified by Parameter2 and continuing for the number of characters equal to the length specified by Parameter3.

Data Types

Notes

If the starting location is a negative value, or greater than the length of the source string, an error occurs.

The first character of a string is located at position 1 (not position 0).

If you omit length, the substring identifies characters to the end of the source string.

If length exceeds the number of characters in the source string, the function identifies only characters until the end of the source string.

If Parameter1, Parameter2, or Parameter3 is an empty list, the function returns an empty list.

Liquid Data generates an error if Parameter1 is not a string or if the starting location is less than 1.

Liquid Data is able to process either format of xf:substring. Adding a third parameter automatically invokes Format 2.

XQuery Specification Compliance

 


xf:substring-after

Returns that part of the Parameter1 source string that follows the first occurrence of those characters specified in Parameter2.

Data Types

Notes

If Parameter2 is a zero-length string, the function returns the value of Parameter1. If Parameter1 is a zero-length string and Parameter2 is a zero-length string, the function returns a zero-length string.

If Parameter1 does not contain a string that is equal to Parameter2, the function returns a zero-length string.

If Parameter1 or Parameter2 is an empty list, the function returns an empty list.

XQuery Specification Compliance

Liquid Data does not support the xf:substring-after format that accepts collations.

Examples

 


xf:substring-before

Returns that part of the Parameter1 source string that precedes the first occurrence of those characters specified in Parameter2.

Data Types

Notes

If Parameter2 is a zero-length string, the function returns the value of Parameter1. If Parameter1 is a zero-length string and Parameter2 is a zero-length string, the function returns a zero-length string.

If Parameter1 does not contain a string that is equal to Parameter2, the function returns a zero-length string.

If Parameter1 or Parameter2 is an empty list, the function returns an empty list.

XQuery Specification Compliance

Liquid Data does not support the xf:substring-before format that accepts collations.

Examples

 


xf:upper-case

Returns the value of the input string after translating every lower-case letter to its uppercase correspondent.

Data Types

Notes

Every lower-case letter that does not have an uppercase corresponding value and every character that is not a lower-case letter appears in the output in its original form.

If the source value is an empty list, the function returns an empty list.

Liquid Data generates an error if the parameter is not a string.

XQuery Specification Compliance

Conforms to the current specification.

Examples

 


xfext:match

Returns a list of integers (either an empty list with 0 integers or a list with 2 integers) specifying which characters in the string input matches the input regular expression. When the function returns a match, the first integer represents the index of (the position of) the first character of the matching substring and the second integer represents the number of matching characters starting at the first match.

Data Types

Notes

The index of the first character of the input source is 1, the index of the second character is 2, and so on.

The regularExpression input uses a standard regular expression language. The regular expression language uses the following components:

Table 9-4 Regular expression syntax examples for the xfext:match function  

Syntax Example

Description

Characters

unicode

Matches the specified unicode character.

\

Used to escape metacharacters such as *, +, and ?.

\\

Matches a single backslash ( \ ) character.

\0nnn

Matches the specified octal character.

\0xhh

Matches the specified 8-bit hexidecimal character.

\\uxhhh

Matches the specified 16-bit hexidecimal character.

\t

Matches an ASCII tab character.

\n

Matches an ASCII new line character.

\r

Matches an ASCII return character.

\f

Matches an ASCII form feed character.

Simple Character Classes

[bc]

Matches the characters b or c.

[a-f]

Matches any character between a and f.

[^bc]

Matches any character except b and c.

Predefined Character Classes

.

Matches any character except the new line character.

\w

Matches a word character: an alphanumeric character or the underscore ( _ ) character.

\W

Matches a non-word character.

\s

Matches a white space character.

\S

Matches a non-white space character.

\d

Matches a digit.

\D

Matches a non-digit.

Greedy Closures—match as many characters as possible

A*

Matches expression A zero or more times.

A+

Matches expression A one or more times.

A?

Matches expression A zero or one times.

A(n)

Matches expression A exactly n times.

A(n,)

Matches expression A at least n times.

A(n, m)

Matches expression A between n and m times.

Reluctant Closures—match as few characters as possible (stops when a match is found)

A*?

Matches expression A zero or more times.

A+?

Matches expression A one or more times.

A??

Matches expression A zero or one times.

Logical Operators

AB

Matches expression A followed by expression B.

A|B

Matches expression A or expression B.

(A)

Used for grouping expressions.

XQuery Specification Compliance

This is an extended function and is not part of the XQuery specification.

Examples

xfext:trim

Returns the value of the input string with leading and trailing white space removed from the string.

Data Types

Notes

If the input string is an empty list, the function returns an empty list.

Liquid Data generates an error if the parameter is not a string.

XQuery Specification Compliance

The xfext:trim function is an extended function. For more information about extended functions, see Naming Conventions.

Examples

 

Back to Top Previous Next