Handle Right-Aligned Numeric Fields
Parse and generate right-justified numeric fields in fixed-width files. Covers leading spaces, zero padding, and decimal alignment.
Detailed Explanation
Right-Aligned Numeric Fields
In many fixed-width formats — especially financial files — numeric values are right-justified within their column width. This means shorter numbers have leading spaces or zeros.
Example Data
Product A 123.45
Product B 9876.00
Product C 1.99
Product D 100000.00
Here the price column (positions 12-22) is right-aligned. The actual values are 123.45, 9876.00, 1.99, and 100000.00.
Column Setup
| Column | Width | Alignment | Trim |
|---|---|---|---|
| Product | 12 | Left | Yes |
| Price | 10 | Right | Yes |
CSV Output
Product,Price
Product A,123.45
Product B,9876.00
Product C,1.99
Product D,100000.00
Zero-Padded Numerics
Financial formats often use zero-padding instead of space-padding:
ACCT0010000012345
ACCT0020000098765
ACCT0030000000100
When converting back from CSV to fixed-width, select Zero as the padding character and Right alignment to reproduce this format.
Decimal Handling
The converter treats values as strings — it does not interpret decimal points specially. If your format requires implied decimals (e.g., 12345 meaning 123.45), you will need to handle the decimal insertion in a separate processing step.
Use Case
Parsing financial transaction files where amounts are right-justified with leading zeros or spaces, such as ACH/NACHA files, insurance claim files, or accounting system exports.