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

Parsing String with variable element #38

Closed
jaysara opened this issue May 16, 2024 · 3 comments · Fixed by #42
Closed

Parsing String with variable element #38

jaysara opened this issue May 16, 2024 · 3 comments · Fixed by #42
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jaysara
Copy link

jaysara commented May 16, 2024

I have a variable segments structure like,

A001{field1-2character}{field2-12characters}{field3-21characters}C001{field4-1character}{field5-10characters}{field6-13characters}D001{field7-12character}{field8-2characters}{field9-21characters}

another string can be

A001{field1-2character}{field2-12characters}{field3-21characters}B001{field11-5characters}{field12-8characters}{field13-3characters}D001{field7-12character}{field8-2characters}{field9-21characters}E001{field20-5characters}{field21-12characters}{field22-2characters}

As mentioned we have segments like A001, B001 , C001, D001, etc.. All segments have fixed format fields. However some segments may or may not be present in a given string. The parser needs to figure out whether a segment is there or not and execure parser logic specific to the segment.

Can this library help ?

@g0ddest
Copy link
Owner

g0ddest commented May 16, 2024

Okay, we could make it if we extend FixedLine with regexp or/and predicate functionality and you could pass your conditions there. Will it work for you?

@g0ddest g0ddest self-assigned this May 16, 2024
@g0ddest g0ddest added enhancement New feature or request good first issue Good for newcomers labels May 16, 2024
@g0ddest
Copy link
Owner

g0ddest commented May 18, 2024

@jaysara , check out the PR :)

@g0ddest g0ddest linked a pull request Aug 20, 2024 that will close this issue
@g0ddest
Copy link
Owner

g0ddest commented Aug 20, 2024

I've merged predicate solution, try it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants