commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duncan Jones (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LANG-1043) isAllUpperCase should only check Alpha characters
Date Thu, 09 Oct 2014 16:45:34 GMT

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

Duncan Jones edited comment on LANG-1043 at 10/9/14 4:45 PM:
-------------------------------------------------------------

The isAlpha method is the character equivalent to isNumeric.

I believe two new methods that check if any alphabetic characters are upper/lowercase should
be generated, and the current isAllUpperCase and isAllLowerCase should call the new methods
along with the isAlpha method. This would lead to a more generic API with multiple predicates
that could be used in various combinations as required, as is my understanding of the library.

{code:java}
public boolean isUpperCase(CharSequence)    //Checks if alphabetic characters are uppercase
public boolean isLowerCase(CharSequence)    //Checks if alphabetic characters are lowercase

public boolean isAllUpperCase(CharSequence)   //Checks that all characters are alphabetic
and uppercase
public boolean isAllLowerCase(CharSequence)   //Checks that all characters are alphabetic
and lowercase
{code}

I will throw together a proposed patch for this over the evening.


was (Author: jamessawle):
The isAlpha method is the character equivalent to isNumeric.

I believe two new methods that check if any alphabetic characters are upper/lowercase should
be generated, and the current isAllUpperCase and isAllLowerCase should call the new methods
along with the isAlpha method. This would lead to a more generic API with multiple predicates
that could be used in various combinations as required, as is my understanding of the library.

public boolean isUpperCase(CharSequence)    //Checks if alphabetic characters are uppercase
public boolean isLowerCase(CharSequence)    //Checks if alphabetic characters are lowercase

public boolean isAllUpperCase(CharSequence)   //Checks that all characters are alphabetic
and uppercase
public boolean isAllLowerCase(CharSequence)   //Checks that all characters are alphabetic
and lowercase

I will throw together a proposed patch for this over the evening.

> isAllUpperCase should only check Alpha characters
> -------------------------------------------------
>
>                 Key: LANG-1043
>                 URL: https://issues.apache.org/jira/browse/LANG-1043
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.3.2
>            Reporter: Frédéric JECKER
>             Fix For: Discussion
>
>         Attachments: LANG-1043.patch
>
>
> Currently, isAllUpperCase checks character by character if the current character is UpperCase
or not using Character.isUpperCase().
> The problem is that characters like spaces aren't considered as uppercase characters.
> IMHO, isAllUpperCase should only check the state of alpha characters so that :
> - StringUtils.isAllUpperCase("ABC DEF GHI") = true (false currently)
> - StringUtils.isAllUpperCase("ABC / DEF") = true (false currently)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message