You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the FieldTrimAttribute with the FieldFixedLengthAttribute trims whitespace correctly, but when you specify trim characters in the FieldTrimAttribute 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 about TrimChars (or LineInfo.WhitespaceChars if TrimChars is null or empty).
The text was updated successfully, but these errors were encountered:
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).The text was updated successfully, but these errors were encountered: