StringLengthFormatter
From Fmepedia
| This page contains a Custom Transformer created by an fmepedia user. See the attached files list at the foot of this page for the zip file containing this custom transformer. |
Created by: Dmitri Bagh
This transformer formats attributes to the specified length either truncating or padding the incoming attributes. It creates a new attribute called _slfDest where the formatted value is stored.
In the future, this transformer will be able to rewrite the incoming attributes, and there will be no need to rename them after the transformer.
If we have the following text file as a source dataset,
Capital,Country,Continent,FIPS Phnom Penh,Cambodia,Asia,CB George Town,Cayman Islands,North America,CJ Yaounde,Cameroon,Africa,CM Praia,Cape Verde,Africa,CV Ottawa,Canada,North America,CA
and we set all Lengths to 10, the resulting table will look as following:
Capital ,Country ,Continent ,FIPS Phnom Penh ,Asia ,Cambodia ,CB George Town,North Ameri,Cayman Isla,CJ Yaounde ,Africa ,Cameroon ,CM Praia ,Africa ,Cape Verde ,CV Ottawa ,North Ameri,Canada ,CA
