LANG-1806: Allow floating-point suffixes in NumberUtils.isParsable#1546
LANG-1806: Allow floating-point suffixes in NumberUtils.isParsable#1546Jagdish-Singh-Bisht wants to merge 3 commits intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Hello @Jagdish-Singh-Bisht
This PR doesn't handle:
- 1.2e-5d
- 1.2e-5f
You did not follow the instructions in the PR template:
- Run
mvn - Fix all errors
- Also remove the extra blank lines.
Rebase on git master where I added test TODOs for the above.
|
Thanks for the review. Understood regarding the scientific notation cases (1.2e-5d / 1.2e-5f). |
1ad007d to
5e48311
Compare
|
Thanks for the review and guidance. I have rebased on the latest master, cleaned up formatting, and verified the build with mvn test. This PR intentionally limits the scope to suffix-only cases(2.f, 2.d) as a minimal follow-up to LANG-1695. Please let me know if you'd prefer those cases to be handled in this PR. |
|
@Jagdish-Singh-Bisht |
|
I have pushed the updated implementation that fully supports scientific notation with float/double suffixes. |
There was a problem hiding this comment.
Hello @Jagdish-Singh-Bisht
Thank you for updating your PR. Unfortunately, you did not follow the instructions in the PR template. You must run mvn by itself to validate your changes, which in this case, will fail the Checkstyle portion of the build.
I was thinking of something simpler, using a regular expression: Please test #1560 for your use case and me know if that works in your application.
|
Closing: No reply. Implemented in git master with #1560 |
This PR addresses LANG-1806 as a small follow-up to LANG-1695.
NumberUtils.isParsable currently rejects strings such as "1.f" and "1.d", even though Float.parseFloat("1.f") and Double.parseDouble(1.d") succeed.
The test suite already contained TODOs for these cases, this change uncomments those assertions and updates the parsing logic to allow floating-point suffixes (f/F/d/D) only when they appear as the final character.
The change is intentionally minimal and doesn not affect other numeric formats.