Open kevinmbrooks opened 6 years ago
This is still an issue in 2023. When using a [FieldFixedLength]
attribute in combination with a [FieldTrim(TrimMode.Right, '0')]
(for example), the trailing zeros are not trimmed as expected. An examination of the source code shows that FieldBase.TrimChars
is not used by the FieldBase.TrimString
method.
Using the
FieldTrimAttribute
with theFieldFixedLengthAttribute
trims whitespace correctly, but when you specify trim characters in theFieldTrimAttribute
constructor, they are ignored and whitespace is still trimmed. A brief look at the code suggests to me that delimited fields are handling trim characters correctly, but fixed length fields are ignoring them.I've only just started to look at the code, but it looks like
FileBase.TrimString
could be modified to care aboutTrimChars
(orLineInfo.WhitespaceChars
if TrimChars is null or empty).