SubstringExtractor
Extracts a substring from the source attribute. The substring is taken from the range of characters specified.
Parameters
Specify the attribute or other source for the string from which you want to extract a substring.
Specify the position in the source string from which to begin extracting a substring, and the position in the source string to end the substring. 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).
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.
The index parameters may 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.
Specify a name for the attribute that holds the substring.
Examples
- To trim off the first character only, and extract the rest of the source string, use a start of 1 and an end of -1.
- To trim off the last character only, and extract the rest of the source string, 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.
- To trim off a single character only, use a start of 4 and an end of 4.
- If you want to split the four first characters of the string ABCDE, use four SubstringExtractor transformers and set their respective properties as follows:
0,0
1,1
2,2
3,3
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Transformer Categories
FME Community
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for samples and information about this transformer on the FME Community.