Versions Compared

Key

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

...

The FIND function looks for one 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( "File" , File.name ) = UNKNOWN
  • 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"

...

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

Syntax

Code Block
LAST integer CHARACTERS OF string
LAST 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. 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

LENGTH returns 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( ? ) = ?

UPPER

UPPER returns a string with all characters in uppercase

Syntax

Code Block
UPPER ( string )

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

Return type

  • string

Example

  • UPPER( "hello" ) = "HELLO"

  • UPPER( "WORLD" ) = "WORLD"

  • UPPER( "hello world " ) = "HELLO WORLD "

  • UPPER( " hELLo " ) = " HELLO "

  • UPPER( ? ) = ?

LOWER

LOWER returns a string with all characters in lowercase

Syntax

Code Block
LOWER ( string )

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

Return type

  • string

Example

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

CAPITALIZE

CAPITALIZE returns 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.
  • lowerTheRest - An attribute of base type boolean, an expression that results in a boolean or a constant boolean value, indicating that the other characters need to be lowercased. This parameter is optional and if it is not supplied, the other characters are left untouched.

Return type

  • string

Example

  • CAPITALIZE( "hello" ) = "Hello"
  • CAPITALIZE( "WORLD" ) = "WORLD"

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

  • CAPITALIZE( " hELLo " ) = " hELLo "

    UI Text Box
    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.

  • CAPITALIZE( ? ) = ?

TRIM

TRIM strips the leading and trailing spaces from a string 

Syntax

Code Block
TRIM ( string )

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

Return type

  • string

Example

  • TRIM( "Hello" ) = "Hello"
  • TRIM( "Hello World" ) = "Hello World"
  • TRIM( "   Hello   World   " ) = "Hello   World"
  • TRIM( ? ) = ?

INDEXOF

INDEXOF returns the index of the first occurrence of a specified substring in a string

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 - 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 search for 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.

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

LASTINDEXOF returns the index of the last occurrence of a specified substring in a string

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 - 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 search for the substring should start (inclusive), searching backwards. This can be either an attribute of base type integer, an expression that results in an integer or a constant integer value.

Return type

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

Example

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

SUBSTRING

SUBSTRING returns 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

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.

Return type

  • string

Example

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

SUBSTRING-BEFORE

SUBSTRING-BEFORE returns 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 )

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

Return type

  • string

Example

  • SUBSTRING-BEFORE( "hello:world" , ":" ) = "hello"
  • SUBSTRING-BEFORE( "hello:world:all" , ":" ) = "hello"
  • SUBSTRING-BEFORE( "hello:world" , "a" ) = ""

SUBSTRING-AFTER

SUBSTRING-AFTER returns 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 )

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

Return type

  • string

Example

  • SUBSTRING-AFTER( "hello:world" , ":" ) = "world"
  • SUBSTRING-AFTER( "hello:world:all" , ":" ) = "world:all"
  • SUBSTRING-AFTER( "hello:world" , "a" ) = ""

SPLIT

SPLIT returns a multivalue 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 replace string The function is case-sensitive.

Syntax

Code Block
REPLACE( pattern , string , replace )
  • 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( "File" , File.name ) = UNKNOWN
  • 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"