This article provides a comprehensive guide on using all the string functions available in Decision Model and Notation (DMN). These functions are essential for modelling business decisions using DMN.
DMN String Functions Reference
| Function | Parameters | Example | Result | Purpose |
|---|---|---|---|---|
| substring (value, index, length) | value (string): a value to be used as source (Mandatory) index (string): The one-based starting character position of a substring in this instance length (int): The number of characters in the substring (optional) | substring (‘Substring this sentence', 1, 3) | Sub | Retrieves a substring from a string value. 1st place position is 1, last position is -1. |
| string length (value) | value (Numeric): Any number (i.e. float, decimal, double, long, in). (Mandatory) scale : Numbers of required scale to be ceiling (optional) | string length ('11/23DavaneyAv') | 14 | Return the number of characters (or code points) in the string. |
| upper case (value) | value (string): the value to be converted to uppercase (Mandatory) | upper case (‘hello') | HELLO | Returns a copy of the string converted to uppercase. |
| lower case (value) | value (string): the value to be converted to lowercase (Mandatory) | lower case (‘HeLlo123') | hello123 | Returns a copy of the string converted to lowercase. |
| substring before (value, match) | value(string): a value to be used as source (Mandatory) match: a part of the value to match with (Mandatory) | substring before (‘macdonald', ‘na') | ‘macdo' | Return substring of string before the match in string |
| substring after (value, match) | value(string): a value to be used as source (Mandatory) match: a part of the value to match with (Mandatory) | substring after (‘macdonald', ‘na') | ‘ld' | Return substring of string after the match in string |
| replace (value, pattern, replacement, flags) | value: a value to be used as source (Mandatory) pattern: the pattern identifies which substrings in the input string should be replaced. (Mandatory) replacement: New string for the replacement flags: Optional | replace(“Credentials used: password=MySecurePa$$w0rd!.”, “(password|pwd)=[^.,; ]+”, “\1=[REDACTED]”, “i”) | Credentials used: \1=[REDACTED]. | Regular expression pattern matching and replacement. |
| contains (value, match) | value (string) : value to be checked (Mandatory) match(string): the string to match with (Mandatory) | contains(“The product quality is excellent.”, “shipping”) | false | Check the string contain the match. |
| starts with (value , match) | value (string) : value to be checked (Mandatory) match(string): the starting string to match with (Mandatory) | starts with(“TRN-US-2025-54321”, “TRN-EU-“) | false | Determines whether the beginning of this string instance matches a specified string. |
| ends with (value, match) | value (string) : value to be checked (Mandatory) match(string): the ending string to match with (Mandatory) | ends with(“quarterly_report.xlsx”, “.xlsx”) | true | Determines whether the end of this string instance matches a specified string. |
| matches (value, pattern, plags) | value (string): Input string to check. If it is not a string, it will return false (Mandatory) pattern (string): regexp pattern (Mandatory) | matches(“555-123-4567”, “^\d{3}-\d{3}-\d{4}$”, “”) | true | Determines whether a string matches a specific regular expression pattern. |
| split (value, splitter) | value (string): a value to be split (Mandatory) splitter (string, array): splitter char, string or an array of multiple splitter (Mandatory) | split (‘Split this sentence into words', ‘ ‘) | [ “Split”, “this”, “sentence”, “into”, “words” ] | Splits a string into substrings that are based on the characters in an array. |
| string join (value, splitter, trim) | value (string): a value to be split (Mandatory) splitter (string): splitter char, string or an array of multiple splitter (optional) | string join([“documents”, “reports”, “quarterly”], “/”) | “documents/reports/quarterly” | Concatenates the elements of specified members of a collection/array, using the specified separator between each member. The output is a string. |

