commons-issues mailing list archives

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

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

Sebb edited comment on LANG-1043 at 10/9/14 6:00 PM:
-----------------------------------------------------

What about non-Graphic characters? e.g. CR, LF etc.?
They are not usually valid in names, but the proposal and current patch ignore them.

AFAICT, the proposal is equivalent to checking if there are any lower-case characters in the
String and inverting the result.
If that is what is wanted, it is easy enough to do using the regex

{noformat}
(?s).*\p{javaLowerCase}
{noformat}

and the Matcher#lookingAt() method


was (Author: sebb@apache.org):
What about non-Graphic characters? e.g. CR, LF etc.?
They are not usually valid in names, but the proposal and current patch ignore them.

AFAICT, the proposal is equivalent to checking if there are any lower-case characters in the
String and inverting the result.
If that is what is wanted, it is easy enough to do using the regex

{noformat}
.*\p{javaLowerCase}
{noformat}

and the Matcher#lookingAt() method

> 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