commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julien HENRY (JIRA)" <j...@apache.org>
Subject [jira] Created: (LANG-625) Add StringUtils.containsWhitespace(String str)
Date Tue, 15 Jun 2010 13:31:26 GMT
Add StringUtils.containsWhitespace(String str)
----------------------------------------------

                 Key: LANG-625
                 URL: https://issues.apache.org/jira/browse/LANG-625
             Project: Commons Lang
          Issue Type: New Feature
    Affects Versions: 2.5
            Reporter: Julien HENRY


Please add the new method StringUtils.containsWhitespace(String str). Here is the version
in the Spring framework:

/**
	 * Check whether the given CharSequence contains any whitespace characters.
	 * @param str the CharSequence to check (may be <code>null</code>)
	 * @return <code>true</code> if the CharSequence is not empty and
	 * contains at least 1 whitespace character
	 * @see java.lang.Character#isWhitespace
	 */
	public static boolean containsWhitespace(CharSequence str) {
		if (!hasLength(str)) {
			return false;
		}
		int strLen = str.length();
		for (int i = 0; i < strLen; i++) {
			if (Character.isWhitespace(str.charAt(i))) {
				return true;
			}
		}
		return false;
	}

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


Mime
View raw message