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

fix: parse lines with multiple equal signs #100

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

techouse
Copy link
Collaborator

@techouse techouse commented Apr 2, 2024

In v0.5.4 I introduced a simpler way of splitting a line by =

final [String lhs, String rhs] = stripped.split('=');

However, this is inadequate when attempting to parse something like

SOME_URL=https://www.my-awesome-website.com/index.php?foo=bar&baz=qux

This PR fixes this by implementing String.partialSplit inspired by this StackOverflow answer

final [String lhs, String rhs] = stripped.partialSplit('=', 2);

If splitting the string would result in more than 2 items, the final element will contain the unsplit remainder of the string.


Fixes #99

@techouse techouse added the bug Something isn't working label Apr 2, 2024
@techouse techouse self-assigned this Apr 2, 2024
@techouse techouse requested a review from petercinibulk as a code owner April 2, 2024 22:10
@techouse techouse changed the title 🐛 fix #99 parsing lines with multiple equals signs fix: fix #99 parsing lines with multiple equals signs Apr 2, 2024
@techouse techouse changed the title fix: fix #99 parsing lines with multiple equals signs fix: fix parsing lines with multiple equals signs Apr 2, 2024
@techouse techouse changed the title fix: fix parsing lines with multiple equals signs fix: parse lines with multiple equals signs Apr 2, 2024
@techouse techouse changed the title fix: parse lines with multiple equals signs fix: parse lines with multiple equal signs Apr 2, 2024
@techouse
Copy link
Collaborator Author

techouse commented Apr 3, 2024

@petercinibulk once you have time, please throw an eye on this 😇

@petercinibulk petercinibulk merged commit d8526e8 into main Apr 3, 2024
3 checks passed
@techouse techouse deleted the fix/issue-99-double-equal-sign branch April 3, 2024 16:49
@techouse techouse mentioned this pull request Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0.5.4 version fail to generate
2 participants