Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Learn more about text functions CONCATENATE, JOIN, MATCH, FIND, FIRST, LAST, LENGTH, UPPERCASE, LOWERCASE, CAPITALIZE, TRIM, INDEXOF, LASTINDEXOF, SUBSTRING, SUBSTRING BEFORE, SUBSTRING AFTER, SPLIT, REPLACE, EQUALS. 

Overview

FunctionDescription

...

CONCATENATEUse the '+' (plus) operator to concatenate strings or a combination of strings and other type values to produce a single string value

...

Syntax

Code Block
string1 + string2 + ... + value1 + ...
  • string1 - The first string that you want to concatenate.
  • string2 - The second string that you want to concatenate.
  • value1 - A value of some type of number, date or boolean that you want to add to the new string value.

Return type

  • string

Examples

  • 12 + " kilometers" = "12 kilometers"
  • "This statement is " + TRUE + "." = "This statement is true."
  • "I was born on " + Me.birthDateAndTime + "."  (Me.birthDateAndTime = 01-12-1970 23:00:45) = "I was born on Tue Dec 01 23:00:45 CET 1970."

...

typeinfo

...

.

...

...

Joins a series of values into one string, separated with a character of your choice

...

Syntax

Code Block
JOIN ( argument1 , argument2 , ... , separator )

...

.

...

...

separator - A string value that will be used as separator symbol.
MATCHCompares

Return type

  • string
UI Text Box
typenote
an UNKNOWN value will be represented as an empty entry in the result string.
UI Text Box
typenote

The CONCAT function is identical to the JOIN function.

Examples

Suppose you have a model containing the following attributes.

 

...

 

  • JOIN ( Person.name , Person.date_of_birth , ";" ) = "John;Sun Jan 01 00:00:00 CET 1995"
  • JOIN ( Person.name , Person.name , "@" ) = "John@John"
  • JOIN ( Person.name , Person.family_name , YEARS BETWEEN Person.date_of_birth AND DATE ( 2015 , 01 , 01 ) , ";" ) = "John;;20"

MATCH

...

a string pattern to another string and returns TRUE if the string exactly matches the pattern, and otherwise FALSE. The MATCH function is case-sensitive.

...

Syntax

...

  • pattern - An attribute of base type string or a string value. String must be a valid regular expression. The regular expressions used in several Blueriq Studio functions are common Java 1.4 expressions. For a complete documentation we refer to the online java documentation.
  • string - String value, attribute of base type string or an expression that results in a string value.

Return type

  • boolean

Examples

If the attribute File.name is of base type string and its value is "Thisfile_1.doc" then

  • MATCH ( "Thisfile_1.doc" , File.name ) = TRUE
  • MATCH ( File.name , "Thisfile_1.doc" ) = TRUE
  • MATCH ( " Thisfile_1.doc" , File.name ) = FALSE
  • MATCH ( "thisfile_1.doc" , File.name ) = FALSE
  • MATCH ( "[A-Z]hisfile_1.doc" , File.name ) = TRUE
  • MATCH ( "[a-z]hisfile_1.doc" , File.name ) = FALSE
  • MATCH ( "Thisfile_[0-9].doc" , File.name ) = TRUE
  • MATCH ( ".............." , File.name ) = TRUE
  • MATCH ( ".*" , File.name ) = TRUE
  • MATCH ( "**" , "**" ) results in an error message, because "**" is not a valid regular expression
FINDLooks

FIND

...

for a string pattern within another string and returns the first matching characters. The function is case-sensitive

...

Syntax

Code Block
FIND ( pattern , string )
FIND ( pattern , string , startIndex )
  • pattern - An attribute of base type string or a string value. String must be a valid regular expression. The regular expressions used in several Blueriq Studio functions are common Java 1.4 expressions. For a complete documentation we refer to the online java documentation.
  • string - An attribute of base type string or an expression that results in a string.
  • startIndex - A positive integer value indicating at which character of the string the search should start (inclusive). This can be either an attribute of base type integer, an expression that results in an integer or a constant integer value. The first character starts at index 0.

Return type

  • string

Examples

If File.name is an attribute of base type string with value "Thisfile_1.doc", then:

...

FIND ( "_[1-5]" , File.name ) = "_1"

...

.

...

...

FIND ( "el" , "Hello" ) = "el"

...

FIND ( "el" , "Hello" , 2 ) = UNKNOWN

...

FIND ( "eo" , "Hello" ) = UNKNOWN

...

FIND ( "\s[a-zA-Z]+" , "Hello world example" ) = "world"

...

FIND ( "\s[a-zA-Z]+" , "Hello world example" , 6 ) = "example"
FIRSTReturns

FIRST

...

the first character(s) of a string, based on the number of characters you specify

...

Syntax

Code Block
FIRST integer CHARACTERS OF string
FIRST CHARACTER OF string
  • integer - A positive integer value. This can be either an attribute of base type integer, an expression that results in an integer or a constant integer value. FIRST CHARACTER OF can be used to retrieve only the first character of the string.
  • string - An attribute of base type string, an expression that results in a string or a constant string value.

Return type

  • string

...

typenote

...

.

...

If File.name is an attribute of base type string with value "Thisfile_1.doc" and the integer attribute File.prefix has value 8 then:

  • FIRST File.prefix CHARACTERS OF File.name = "Thisfile"
  • FIRST CHARACTER OF File.name = "T"
  • FIRST 5 CHARACTERS OF "pieceofcake" = "piece"

LAST

...

LASTReturns the last character(s) of a string, based on the number of characters you specify.

...

Syntax

...

...

LAST integer CHARACTERS OF string
LAST CHARACTER OF string
LENGTHReturns
  • integer - A positive integer value. This can be either an attribute of base type integer, an expression that results in an integer or a constant integer value. LAST CHARACTER OF can be used to retrieve only the last character of the string.
  • string - An attribute of base type string, an expression that results in a string or a constant string value.

Return type

  • string
UI Text Box
typenote

If you prefer a functional syntax, you can use the STR_BACK ( string, integer ) function. Example: STR_BACK("Blueriq", 3) = "riq"

Examples

If File.name is an attribute of base type string with value "Thisfile_1.doc" and the integer attribute File.extension has value 3 then:

  • LAST File.extension CHARACTERS OF File.name = "doc"
  • LAST CHARACTER OF File.name = "c"
  • LAST 4 CHARACTERS OF "pieceofcake" = "cake"

LENGTH

...

the length of a string

...

Syntax

Code Block
LENGTH ( string )
  • string - An attribute of base type string, an expression that results in a string or a constant string value.

Return type

  • integer
UI Text Box
typenote

Spaces at the start of the end of the string are counted as well, the string is not trimmed.

Example

  • LENGTH ( "Blueriq" ) = 7
  • LENGTH ( " Blueriq " ) = 9
  • LENGTH ( ? ) = ?

UPPERCASE

...

UPPERCASEReturns a string with all characters in uppercase

...

Syntax

Code Block
UPPERCASE ( string )

...

.

...

Return type

  • string

Example

...

UPPERCASE ( "hello" ) = "HELLO"

...

 

...

...

UPPERCASE ( "hello world " ) = "HELLO WORLD "

...

UPPERCASE ( " hELLo " ) = " HELLO "

...

LOWERCASEReturns

LOWERCASE

...

a string with all characters in lowercase

...

CAPITALIZEReturns

Syntax

Code Block
LOWERCASE ( string )
  • string - An attribute of base type string, an expression that results in a string or a constant string value.

Return type

  • string

Example

  • LOWERCASE ( "hello" ) = "hello"
  • LOWERCASE ( "WORLD" ) = "world"
  • LOWERCASE ( "Hello World " ) = "hello world "
  • LOWERCASE ( " hELLo " ) = " hello "
  • LOWERCASE ( ? ) = ?

CAPITALIZE

...

a string with the first character uppercased

...

Syntax

Code Block
CAPITALIZE ( string )
CAPITALIZE ( string, lowerTheRest )

...

string - An attribute of base type string, an expression that results in a string or a constant string value.

...

.

...

Return type

  • string

Example

...

CAPITALIZE ( "hello" ) = "Hello"

...

CAPITALIZE ( "WORLD" ) = "WORLD"

...

CAPITALIZE ( "hello world " ) = "Hello world "

...

 

...

...

typenote

...

The input string is not trimmed, so in this case the first character is a space.

...

CAPITALIZE ( "hello" , TRUE ) = "Hello"

...

CAPITALIZE ( "WORLD" , TRUE ) = "World"

...

CAPITALIZE ( "hello world " , TRUE ) = "Hello world "

...

CAPITALIZE ( " hELLo " , TRUE ) = " hello "

UI Text Box
typenote

The input string is not trimmed, so in this case the first character is a space.

...

TRIMStrips

TRIM

...

the leading and trailing spaces from a

...

Syntax

Code Block
TRIM ( string )
string

...

.

...

Return type

  • string

Example

...

TRIM ( "Hello" ) = "Hello"

...

 

...

...

Returns the index of the first occurrence of a specified

...

Syntax

Code Block
INDEXOF ( string , substring )
INDEXOF ( string , substring , startIndex )

...

string - An attribute of base type string, an expression that results in a string or a constant string value.
substring

...

in

...

a

...

string

...

.

...

LASTINDEXOFReturns

Return type

  • integer - the index of the first occurrence of the specified substring or -1 if it is not found

Example

  • INDEXOF ( "Hello world" , "o" ) = 4
  • INDEXOF ( "Hello world" , "o" , 5 ) = 7
  • INDEXOF ( "Hello world" , "a" ) =  -1
  • INDEXOF ( "Hello world" , "o" , 8 ) =  -1

LASTINDEXOF

...

the index of the last occurrence of a specified

...

Syntax

Code Block
LASTINDEXOF ( string , substring )
LASTINDEXOF ( string , substring , startIndex )

...

string - An attribute of base type string, an expression that results in a string or a constant string value.
substring

...

in a string

...

.

...

 

...

Return type

  • integer - the index of the last occurrence of the specified substring or -1 if it is not found

...

  • LASTINDEXOF ( "Hello world" , "o" ) = 7
  • LASTINDEXOF ( "Hello world" , "o" , 6 ) = 4
  • LASTINDEXOF ( "Hello world" , "a" ) =  -1
  • LASTINDEXOF ( "Hello world" , "o" , 3 ) =  -1
SUBSTRINGReturns

SUBSTRING

...

the substring of a given string starting from the index provided and ending at the end index if provided, or the end of the string

...

SUBSTRING BEFOREReturns

Syntax

Code Block
SUBSTRING ( string , startIndex )
SUBSTRING ( string , startIndex , endIndex )
  • string - An attribute of base type string, an expression that results in a string or a constant string value.
  • startIndex - A positive integer value indicating at which character the substring should start (inclusive). This can be either an attribute of base type integer, an expression that results in an integer or a constant integer value. The first character starts at index 0.
  • endIndex - A positive integer value indicating at which character the substring should end (exclusive). This can be either an attribute of base type integer, an expression that results in an integer or a constant integer value. The endIndex cannot exceed the length of the string and should be larger than the startIndex.

Return type

  • string

Example

  • SUBSTRING ( "Hello world" , 1 ) = "ello world"
  • SUBSTRING ( "Hello world" , 0 , 1 ) = "H"
  • SUBSTRING ( "Hello world" , 1 , 5 ) = "ello"
  • SUBSTRING ( "Hello world" , 0 ) = "Hello world"
  • SUBSTRING ( "Hello world" , 0 , LENGTH( "Hello world" ) ) = "Hello world"

SUBSTRING_BEFORE

...

the start of a given string before the first occurrence of substring, or an empty string if substring is not found

...

Syntax

Code Block
SUBSTRING_BEFORE ( string , substring )

...

.

...

Return type

  • string

Example

...

SUBSTRING_BEFORE ( "hello:world" , ":" ) = "hello"

...

 

...

...

AFTERReturns

SUBSTRING_AFTER

...

the end of a given string after the first occurrence of substring, or an empty string if substring is not found

...

Syntax

Code Block
SUBSTRING_AFTER ( string , substring )

...

.

...

 

...

Return type

...

Example

  • SUBSTRING_AFTER ( "hello:world" , ":" ) = "world"
  • SUBSTRING_AFTER ( "hello:world:all" , ":" ) = "world:all"
  • SUBSTRING_AFTER ( "hello:world" , "a" ) = ""
  • SUBSTRING_AFTER ( "" , "hello" ) = ""
  • SUBSTRING_AFTER ( "hello" , "" ) = "hello"
SPLITReturns a multivalued string

SPLIT

...

attribute containing every substring that is delimited by the given pattern

Syntax

Code Block
SPLIT ( string , pattern )
  • string - An attribute of base type string, an expression that results in a string or a constant string value.
  • pattern - An attribute of base type string or a string value. String must be a valid regular expression. The regular expressions used in several Blueriq Studio functions are common Java 1.4 expressions. For a complete documentation we refer to the online java documentation.

Return type

  • string (multivalue)

Example

  • SPLIT ( "Hello world" , "o" ) =  [ "Hell" , " w" , "rld" ]
  • SPLIT ( "Hello world" , "a" ) =  [ "Hello world" ]
  • SPLIT ( "Hello" , "o" ) =  [ "Hell" ]
  • SPLIT ( "ooo" , "o" ) =  [ ]
  • Usage: remove dots from a string in combination with the JOIN function
    JOIN ( SPLIT ( "H.E.L.L.O" , "\.") , "" ) = "HELLO"

REPLACE

The REPLACE function replaces every occurrence of a string pattern within another string with a provided replacement string The function is case-sensitive.

Syntax

Code Block
REPLACE ( pattern , string , replacement )
  • pattern - An attribute of base type string or a string value. String must be a valid regular expression. The regular expressions used in several Blueriq Studio functions are common Java 1.4 expressions. For a complete documentation we refer to the online java documentation.
  • string - An attribute of base type string or an expression that results in a string.
  • replacement - An attribute of base type string or an expression that results in a string.

Return type

  • string. If the pattern is not found, the original string is returned.

Examples

  • REPLACE ( ":", "hello:world:example" , " " ) = "hello world example"
  • REPLACE ( "o" , "hello world" , "a" ) = "hella warld"
  • REPLACE ( "O" , "hello world" , "a" ) = "hello world"
  • REPLACE ( "\s" , "hello world example" , "" ) = "helloworldexample"

  • REPLACE ( "\d{2}" , "hello1 world22 example333" , "@" ) = "hello1 world@ example@3"

  • REPLACE ( "" , "hello world" , " " ) = " h e l l o   w o r l d "

EQUALS

REPLACEReplaces every occurrence of a string pattern within another string with a provided replacement string. The function is case-sensitive.
EQUALSCompares two strings and returns TRUE if and only if they are equal. This function is case sensitive.

Go here for more info on the Text Substitution Language (TSL) documentation

Functions

Include Page
Text function CONCATENATE
Text function CONCATENATE


Include Page
Text function JOIN
Text function JOIN


Include Page
Text function MATCH
Text function MATCH


Include Page
Text function FIND
Text function FIND


Include Page
Text function FIRST
Text function FIRST


Include Page
Text function LAST
Text function LAST


Include Page
Text function LENGTH
Text function LENGTH


Include Page
Text function UPPERCASE
Text function UPPERCASE


Include Page
Text function LOWERCASE
Text function LOWERCASE


Include Page
Text function CAPITALIZE
Text function CAPITALIZE


Include Page
Text function TRIM
Text function TRIM


Include Page
Text function INDEXOF
Text function INDEXOF


Include Page
Text function LASTINDEXOF
Text function LASTINDEXOF


Include Page
Text function SUBSTRING
Text function SUBSTRING


Include Page
Text function SUBSTRING BEFORE
Text function SUBSTRING BEFORE


Include Page
Text function SUBSTRING AFTER
Text function SUBSTRING AFTER


Include Page
Text function SPLIT
Text function SPLIT


Include Page
Text function REPLACE
Text function REPLACE


Include Page
Text function EQUALS
Text function EQUALS

EQUALS compares two strings and returns TRUE if and only if they are equal. This function is case sensitive.

UI Text Box
typewarning

Only use this function if you need a case sensitive comparison of two strings. If you want to compare strings case insensitive, use the '=' operator instead.

 

Syntax

Code Block
EQUALS ( string1 , string2 )
string1 EQUALS string2
  • string1 - An attribute of base type string, an expression that results in a string or a constant string value.
  • string2 - An attribute of base type string, an expression that results in a string or a constant string value.

Return type

  • boolean

Example

...

EQUALS ( "hello" , "hello" ) = TRUE

...

EQUALS ( "hello" , "Hello" ) = FALSE

 

UI Text Box
typenote

Note that "hello" = "Hello" will return TRUE because it is case insensitive

...

EQUALS ( "hello" , "hello " ) = FALSE

...