SubstringExtractor

From fmepedia

SubstringExtractor is a Workbench Transformer.

Extracts a substring from the source attribute. The substring is taken from the range of characters specified. Character indexes start at 0 for the first character. A negative index is used to indicate the position relative to the end of the string (-1 is the last character, -2 the second last, and so on). The index can also be taken from the value of another attribute.

If the last index is greater than or equal to the length of the string then it is treated as if it were the end of the string. If the first index is greater than the last index then an empty string is placed into the result attribute.

Each of the index parameters may either be entered as a number, or can be taken from the value of a feature attribute by selecting the attribute name from the pull-down list.

Examples:

To trim off the first character only, use a start of 1 and an end of -1

To trim off the last character only, use a start of 0 and an end of -2

To extract the second and third characters in the string, use a start of 1 and an end of 2

User Comments Add a new comment