Apache NiFi RecordPath Guide
Also available as:


The substring function returns a portion of a String value. The function requires 3 arguments: The value to take a portion of, the 0-based start index (inclusive), and the 0-based end index (exclusive). The start index and end index can be 0 to indicate the first character of a String, a positive integer to indicate the nth index into the string, or a negative integer. If the value is a negative integer, say -n, then this represents the n`th character for the end. A value of `-1 indicates the last character in the String. So, for example, substring( 'hello world', 0, -1 ) means to take the string hello, and return characters 0 through the last character, so the return value will be hello world.


Return value

substring( /name, 0, -1 )

John Doe

substring( /name, 0, -5 )


substring( /name, 1000, 1005 )

<empty string>

substring( /name, 0, 1005)

John Doe

substring( /name, -50, -1)

<empty string>