Author: Nish84
Subject: To trim spaces in a pipe delimited dataset
Posted: Mon Oct 10, 2016 1:54 pm (GMT 5.5)
Hi.. My requirement is to generate a pipe delimited dataset by reformatting a normal fixed-length input file. The output dataset has around 60 fields, as below.
|ABC|12.99|DEF GHI JKLMN|34569999000|..........
If one of the input fields have trailing spaces, I am supposed to trim them. If an input field does not contain any value, I am supposed to represent the field as ||, without any spaces in between.
I understand that checking each input field and moving only the bytes with actual data using reference modification is an option. However, since there are 60 such fields, checking each field individually and moving the data to the output makes my code a bit too long.
Is there any other way to go about it? Any pointer will be of great help. Thanks!
Subject: To trim spaces in a pipe delimited dataset
Posted: Mon Oct 10, 2016 1:54 pm (GMT 5.5)
Hi.. My requirement is to generate a pipe delimited dataset by reformatting a normal fixed-length input file. The output dataset has around 60 fields, as below.
|ABC|12.99|DEF GHI JKLMN|34569999000|..........
If one of the input fields have trailing spaces, I am supposed to trim them. If an input field does not contain any value, I am supposed to represent the field as ||, without any spaces in between.
I understand that checking each input field and moving only the bytes with actual data using reference modification is an option. However, since there are 60 such fields, checking each field individually and moving the data to the output makes my code a bit too long.
Is there any other way to go about it? Any pointer will be of great help. Thanks!