You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thilina Dampahala (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/02/19 16:26:34 UTC

[jira] [Issue Comment Edited] (CONFIGURATION-473) Number to Boolean conversion

    [ https://issues.apache.org/jira/browse/CONFIGURATION-473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13211384#comment-13211384 ] 

Thilina Dampahala edited comment on CONFIGURATION-473 at 2/19/12 3:26 PM:
--------------------------------------------------------------------------

I'm not sure whether you guys have decided to include this feature. I think this is highly useful. (Ex: PHP supports a similar pattern) 

0     - false
0.0   - false
+0.0  - false
-0.0  - false
Actually, any "string".matches("((-|\\+)?[0]+(\\.[0]+)?)+") - false

+/- Numbers (including fractional) - true

I prepared the patch using regular expressions; because I could not find a suitable method in BooleanUtils
                
      was (Author: thdamp):
    I'm not sure whether you guys have decided to include this feature. I think this is highly useful. (Ex: PHP supports a similar pattern) 

0     - false
0.0   - false
+0.0  - false
-0.0  - false
All other +/- Numbers (including fractional) - true

I prepared the patch using regular expressions; because I could not find a suitable method in BooleanUtils
                  
> Number to Boolean conversion
> ----------------------------
>
>                 Key: CONFIGURATION-473
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-473
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Type conversion
>    Affects Versions: 1.7
>            Reporter: Emmanuel Bourg
>             Fix For: 1.9
>
>         Attachments: CONF-473.patch
>
>
> The conversion of number values to boolean is not supported. {{0}} should be converted to {{false}}, and any other number should be converted to {{true}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira