You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "James Sawle (JIRA)" <ji...@apache.org> on 2014/10/08 21:13:34 UTC
[jira] [Updated] (LANG-975) New BooleanUtils method
toBoolean(String, String)
[ https://issues.apache.org/jira/browse/LANG-975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Sawle updated LANG-975:
-----------------------------
Attachment: LANG-975.patch
Possible patch for new method using StringUtils.equals
> New BooleanUtils method toBoolean(String, String)
> -------------------------------------------------
>
> Key: LANG-975
> URL: https://issues.apache.org/jira/browse/LANG-975
> Project: Commons Lang
> Issue Type: Wish
> Components: lang.*
> Affects Versions: 3.2.1
> Reporter: Stephan Knitelius
> Priority: Minor
> Fix For: Patch Needed
>
> Attachments: LANG-975.patch
>
>
> The BooleanUtils#toBoolean(String) works nicely for common boolean String notations.
> However there are many more boolean String notations such as 1/0, ja/nein etc...
> I know this can be achieved via BooleanUtils#toBoolean(String,String,String), however it would be nice to have another Method that only matches the true case, so that invalid cases are automatically matched to false.
> eg:
> BooleanUtils.toBoolean("1", "1") = true
> BooleanUtils.toBoolean("foo", "1") = false
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)