Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 2.8.4: FixedWidthFields.keepPaddingOn not working #405

Closed
vvalencia-cl opened this issue Jul 21, 2020 · 2 comments
Closed

version 2.8.4: FixedWidthFields.keepPaddingOn not working #405

vvalencia-cl opened this issue Jul 21, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@vvalencia-cl
Copy link

Hi. First of all, thanks for this library.

Maybe I'm doing something wrong, but this is not working for me:

import com.univocity.parsers.fixed.FieldAlignment
import com.univocity.parsers.fixed.FixedWidthFields
import com.univocity.parsers.fixed.FixedWidthParser
import com.univocity.parsers.fixed.FixedWidthParserSettings

val fields = FixedWidthFields()
fields.addField("padding", 4, FieldAlignment.RIGHT, '0')
    .addField("text", 4, FieldAlignment.LEFT, ' ')
fields.keepPaddingOn("padding", "text")

val settings = FixedWidthParserSettings(fields)
settings.keepPadding = true

val parser = FixedWidthParser(settings)

println(parser.parseLine("0000abcd")?.contentToString())
println(parser.parseLine("0000    ")?.contentToString())

I've tried with FixedWidthParserSettings.keepPadding and it doesn't working either

The output of this snippet results in:

[null, abcd]
[null, null]

But it should be:

[0000, abcd]
[0000,     ]

Using dependency: com.univocity:univocity-parsers:2.8.4

jbax added a commit that referenced this issue Jul 22, 2020
@jbax
Copy link
Member

jbax commented Jul 22, 2020

Thanks for reporting this. I've fixed it and released version 2.8.5-SNAPSHOT for you to check.

Thank you for using our parsers!

@jbax jbax closed this as completed Jul 22, 2020
@jbax jbax self-assigned this Jul 22, 2020
@jbax jbax added the bug label Jul 22, 2020
@jbax jbax added this to the 2.8.5 milestone Jul 22, 2020
@vvalencia-cl
Copy link
Author

Thanks for reporting this. I've fixed it and released version 2.8.5-SNAPSHOT for you to check.

Thank you for using our parsers!

It worked.
Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants