4.3.2.3. String functions


The following functions support string operations.

注記

In FEEL, Unicode characters are counted based on their code points.

substring( string, start position, length? )

Returns the substring from the start position for the specified length. The first character is at position value 1.

Expand
表4.16 Parameters
ParameterType

string

string

start position

number

length (Optional)

number

Examples

substring( "testing",3 ) = "sting"
substring( "testing",3,3 ) = "sti"
substring( "testing", -2, 1 ) = "n"
substring( "\U01F40Eab", 2 ) = "ab"

注記

In FEEL, the string literal "\U01F40Eab" is the 🐎ab string (horse symbol followed by a and b).

string length( string )

Calculates the length of the specified string.

Expand
表4.17 Parameters
ParameterType

string

string

Examples

string length( "tes" ) = 3
string length( "\U01F40Eab" ) = 3

upper case( string )

Produces an uppercase version of the specified string.

Expand
表4.18 Parameters
ParameterType

string

string

Example

upper case( "aBc4" ) = "ABC4"

lower case( string )

Produces a lowercase version of the specified string.

Expand
表4.19 Parameters
ParameterType

string

string

Example

lower case( "aBc4" ) = "abc4"

substring before( string, match )

Calculates the substring before the match.

Expand
表4.20 Parameters
ParameterType

string

string

match

string

Examples

substring before( "testing", "ing" ) = "test"
substring before( "testing", "xyz" ) = ""

substring after( string, match )

Calculates the substring after the match.

Expand
表4.21 Parameters
ParameterType

string

string

match

string

Examples

substring after( "testing", "test" ) = "ing"
substring after( "", "a" ) = ""

replace( input, pattern, replacement, flags? )

Calculates the regular expression replacement.

Expand
表4.22 Parameters
ParameterType

input

string

pattern

string

replacement

string

flags (Optional)

string

注記

This function uses regular expression parameters as defined in XQuery 1.0 and XPath 2.0 Functions and Operators.

Example

replace( "abcd", "(ab)|(a)", "[1=$1][2=$2]" ) = "[1=ab][2=]cd"

contains( string, match )

Returns true if the string contains the match.

Expand
表4.23 Parameters
ParameterType

string

string

match

string

Example

contains( "testing", "to" ) = false

starts with( string, match )

Returns true if the string starts with the match

Expand
表4.24 Parameters
ParameterType

string

string

match

string

Example

starts with( "testing", "te" ) = true

ends with( string, match )

Returns true if the string ends with the match.

Expand
表4.25 Parameters
ParameterType

string

string

match

string

Example

ends with( "testing", "g" ) = true

matches( input, pattern, flags? )

Returns true if the input matches the regular expression.

Expand
表4.26 Parameters
ParameterType

input

string

pattern

string

flags (Optional)

string

注記

This function uses regular expression parameters as defined in XQuery 1.0 and XPath 2.0 Functions and Operators.

Example

matches( "teeesting", "^te*sting" ) = true

split( string, delimiter )

Returns a list of the original string and splits it at the delimiter regular expression pattern.

Expand
表4.27 Parameters
ParameterType

string

string

delimiter

string for a regular expression pattern

注記

This function uses regular expression parameters as defined in XQuery 1.0 and XPath 2.0 Functions and Operators.

Examples

split( "John Doe", "\\s" ) = ["John", "Doe"]
split( "a;b;c;;", ";" ) = ["a","b","c","",""]

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る