IBM Integration Bus, Version 9.0.0.8 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

Substring

The Substring transform extracts information as required, and moves the extracted string to the output element.

For example, the substring lastname, firstname with a "," delimiter and a substring index of 0 returns the value lastname. If the substring index was changed to 1 the output would be firstname.

The Substring transform uses a delimiter and 0-based index to determine what text to extract from the incoming source string. Based on the specified delimiter, the source string is divided into sections. The index is used to identify which section of the divided string you want to use.

By default the index is 0, indicating that the first section will be used. For example, if the input string is "Aa,Bb,Cc", you can use the Substring transform to specify "," as the delimiter and 1 as the index to return "Bb" as the output.

The fn:substring() XPath 2.0 function takes an input string and a 1-based number to return a part of the original string, beginning from the position indicated. You can also specify a third optional parameter as a number, to indicate the end position to compose the resulting string. For example, the following function call fn:substring("12345", 2, 4) returns "234".

The fn:substring-before() and fn:substring-after() functions are variations of the fn:substring() function. Therefore, if you have an input string with a known delimiter, and if one section of the delimited string is needed, use the Substring transform; otherwise the fn:substring() function (or one of its variations) is likely to be sufficient.

For more information about XPath functions, see the online document W3C XML Path Language (XPath) 2.0.


cm28654_.htm | Last updated Friday, 21 July 2017