commons-lang
commons-lang copied to clipboard
LANG-1484: Allow decimal point at the end of the String
LANG-1484: Allow decimal point at the end of the String because Double.parseDouble, Float.parseFloat allow this.
https://issues.apache.org/jira/projects/LANG/issues/LANG-1484
IMO, we can allow decimal at end of String. Please suggest.
Coverage decreased (-0.0006%) to 95.215% when pulling 81bd39bdf430d256ef37d2bfa86f337d790b5aa5 on saksham93:LANG-1484-NumberUtils into ec92ddd1c605bce0700eace96fb84331ad06c1dd on apache:master.
Maybe we should add a test to ensure the various parsing cases work ?
@nicolasbd - NumberUtilsTest.java has test method for this. Do you have any suggestions to add more? I think it covers most of them. Please suggest
@saksham93 ah sorry I didn't know about those, but looking at them I see this : assertFalse( NumberUtils.isParsable("64.") );
for example
I mean, maybe we should add some tests to ensure your modif is always okay, but I'm new to the project so it might not be necessary as you pointed out, maybe someone else will confirm
@kinow - Hi, Can you please check if this PR looks good to you? Thank you.
Given that crap like -.236
or .18
are considered valid input, I see no reason why not more crap like 64.
should not be allowed.
Not a fan unless testIsParsable
is updated to actually prove that something is parsable or not; for example, update:
assertTrue( NumberUtils.isParsable("64") );
to
assertTrue( NumberUtils.isParsable("64") );
Integer.parseInt("64");