You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.
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
SUBSTRING AFTER substring IN string SUBSTRING_AFTER ( string , substring )
Inputs
- 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
Expression | Result | Type |
---|---|---|
SUBSTRING AFTER ":" IN "hello:world" | "world" | String |
SUBSTRING_AFTER ( "hello:world:all" , ":" ) | "world:all" | String |
SUBSTRING AFTER "a" IN "hello:world" | "" | String |
SUBSTRING_AFTER ( "" , "hello" ) | "" | String |
SUBSTRING_AFTER ( "hello" , "" ) | "hello" | String |
SPLIT
SPLIT
returns a multivalued attribute containing every substring that is delimited by the given pattern.
Syntax
SPLIT string ON pattern SPLIT ( string , pattern )
Inputs
- 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 (multivalued)
Example
Expression | Result | Type |
---|---|---|
SPLIT "Hello world" ON "o" | [ "Hell" , " w" , "rld" ] | String (multivalued) |
SPLIT ( "Hello world" , "a" ) | [ "Hello world" ] | String (multivalued) |
SPLIT "Hello" ON "o" | [ "Hell" ] | String (multivalued) |
SPLIT ( "ooo" , "o" ) | [ ] | String (multivalued) |
SPLIT ( "bot" , "o" ) | [ "b" , "t" ] | String (multivalued) |
SPLIT ( "boot" , "o" ) | [ "b" , "", "t" ] | String (multivalued) |
SPLIT ( "booot" , "o" ) | [ "b" , "", "t" ] | String (multivalued) |
To remove dots from a string in combination with the JOIN function: | ||
JOIN ( SPLIT ( "H.E.L.L.O" , "\.") , "" ) | "HELLO" | String |
If you use the SPLIT
in a default expression on an multivalued attribute, please note that the result will be stored as collection, meaning that all duplicates will be removed. To illustrate this: suppose we have an attribute Test.Splitted
(multivalued), which has the default expression SPLIT ( "H.E.L.L.O" , "\.")
. The result of the expression JOIN ( Test.Splitted , "" ) = "HELO" instead of "HELLO" as in the last example.
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
REPLACE pattern IN string WITH replacement 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
Expression | Result | Type |
---|---|---|
REPLACE ":" IN "hello:world:example" WITH " " | "hello world example" | String |
REPLACE ( "o" , "hello world" , "a" ) | "hella warld" | String |
REPLACE ( "O" , "hello world" , "a" ) | "hello world" | String |
REPLACE "\s" IN "hello world example" WITH "" | "helloworldexample" | String |
REPLACE ( "\d{2}" , "hello1 world22 example333" , "@" ) | "hello1 world@ example@3" | String |
REPLACE ( "" , "hello world" , " " ) | " h e l l o w o r l d " | String |
REPLACE "\s" IN "hello world example" WITH "\s" | "hello\sworld\sexample" | String |
EQUALS
EQUALS
compares two strings and returns TRUE if and only if they are equal. This function is case sensitive.
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
string1 EQUALS string2 EQUALS ( string1 , string2 )
Inputs
- 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
Expression | Result | Type | Note |
---|---|---|---|
"hello" EQUALS "hello" | TRUE | Boolean | |
EQUALS ( "hello" , "Hello" ) | FALSE | Boolean | FALSE because EQUALS is case sensitive |
"hello" EQUALS "hello " | FALSE | Boolean | FALSE because of trailing space |
EQUALS ( "" , "" ) | TRUE | Boolean |