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

Empty arguments don't get interpreted correctly #17

Open
CreepyCre opened this issue Apr 30, 2020 · 2 comments
Open

Empty arguments don't get interpreted correctly #17

CreepyCre opened this issue Apr 30, 2020 · 2 comments

Comments

@CreepyCre
Copy link

javascript_identifier_ has args.length = 1, while
javascript_identifier_, has args.length = 0

javascript_identifier_,,somevalue has args.length = 3, while
javascript_identifier_somevalue,, has args.length = 1

Expected behaviour would be that args.length = amount of commas + 1 in every case. It seems that it will only parse arguments until the last argument with a non empty string. Empty arguments should be arguments as well for consistency.

@BlitzOffline
Copy link
Member

I believe every argument that is empty should or is skipped. Or at least that's what this line is telling me.

@CreepyCre
Copy link
Author

The individual args ending up as null is not an issue here, it will not influence the length.
The actual cause is located here.
If you check the javadocs for String#split, you will see that without specifying a limit it will default to 0, which will drop any trailing empty Strings. The solution here is to use any negative integer as the limit.

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

No branches or pull requests

2 participants