You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2009/12/22 07:13:18 UTC

[jira] Commented: (LANG-573) Add new APIs to StringUtils (countLowerCase, countUpperCase, countDigits)

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

Henri Yandell commented on LANG-573:
------------------------------------

What's the use case?

Thinking generically; isTitleCase, isWhitespace and probably others jump out.

> Add new APIs to StringUtils (countLowerCase, countUpperCase, countDigits)
> -------------------------------------------------------------------------
>
>                 Key: LANG-573
>                 URL: https://issues.apache.org/jira/browse/LANG-573
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Alvin Chee
>
> private static int countUpperCase(String s) {
> 	int cLen = s.length();
> 	int count = 0;
> 	for (int i = 0; i < cLen; i++) {
> 		if (Character.isUpperCase(s.charAt(i)))
> 			count++;
> 	}
> 	return count;
> }
> private static int countLowerCase(String s) {
> 	int cLen = s.length();
> 	int count = 0;
> 	for (int i = 0; i < cLen; i++) {
> 		if (Character.isLowerCase(s.charAt(i)))
> 			count++;
> 	}
> 	return count;
> }
> private static int countDigits(String s) {
> 	int cLen = s.length();
> 	int count = 0;
> 	for (int i = 0; i < cLen; i++) {
> 		if (Character.isDigit(s.charAt(i)))
> 			count++;
> 	}
> 	return count;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.