Whitespace Trimming Options Per Column
Control whitespace trimming behavior for individual columns. Understand when to trim and when to preserve trailing spaces in fixed-width data.
Column Definitions
Detailed Explanation
Per-Column Whitespace Trimming
Fixed-width fields are padded to fill their full width, which means extracted values typically have trailing (or leading) whitespace. The tool provides a trim toggle per column so you can control this behavior individually.
Why Trim?
Most of the time, you want to trim:
| Raw Extracted Value | Trimmed Value |
|---|---|
"John " |
"John" |
" 42" |
"42" |
"Active " |
"Active" |
Trimmed values produce cleaner CSV output and are easier to work with in downstream tools.
Why NOT Trim?
In some cases, whitespace is meaningful:
- Fixed-length codes: A status field of exactly 2 characters where
"A "and"A"have different meanings - Pre-formatted output: Data that will be re-exported to another fixed-width system and must maintain exact character counts
- Checksum fields: Where the exact byte content affects validation
Mixed Trim Configuration
John Smith 30 NYC ACCT001
Jane Doe 25 LON ACCT002
| Column | Width | Trim | Reason |
|---|---|---|---|
| Name | 20 | Yes | Clean display |
| Age | 4 | Yes | Numeric, no padding needed |
| City | 10 | Yes | Clean display |
| Account | 7 | No | Preserve exact format |
How Trimming Works
- When trim is enabled, the tool calls
String.trim()on the extracted substring, removing all leading and trailing whitespace characters (spaces, tabs, etc.) - When trim is disabled, the raw substring is preserved exactly as extracted, including any padding characters
Use Case
Processing fixed-width files where some fields need clean trimmed values for data import while other fields must preserve their exact character content for system compatibility.