commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Sawle (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1043) isAllUpperCase should only check Alpha characters
Date Thu, 09 Oct 2014 21:47:35 GMT

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

James Sawle commented on LANG-1043:
-----------------------------------

I think focussing on the 3 use-cases commented on is counter-productive to this discussion,
as is suggesting regex expressions that users could use instead (it would be easier and cheaper
to have a regex check to replace current isAllUpperCase for example!).

There are a couple of questions that I think should be answered:
- Would a more generic method have use-cases?
- Is sufficient boiler-plate code cut out to justify?
- Would it be possible to use to simplify the current implementation of isAllUpperCase? If
so, this could itself be justification for adding the method

We can never generate perfect validation methods for every situation, but generating simple
blocks that can be used together to cover as many general cases as possible would aid the
wider audience.

The best solution across the entire class would be to come up with a single method that takes
a Predicate interface (similar to that provided in Java 8), that goes over the CharSequence
and modify all current methods to use it. This would allow for quick generic tests, and could
be opened up to allow for more general validation over a CharSequence, and avoid some of the
discussions in here.

> 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