Example usage for org.apache.commons.lang3 CharSequenceUtils toCharArray

List of usage examples for org.apache.commons.lang3 CharSequenceUtils toCharArray

Introduction

In this page you can find the example usage for org.apache.commons.lang3 CharSequenceUtils toCharArray.

Prototype

static char[] toCharArray(final CharSequence cs) 

Source Link

Document

Green implementation of toCharArray.

Usage

From source file:org.apache.commons.lang3.StringUtils.java

/**
 * <p>/* ww  w  .  j a  va2s  . co m*/
 * Checks if the CharSequence contains any character in the given set of characters.
 * </p>
 *
 * <p>
 * A {@code null} CharSequence will return {@code false}. A {@code null} search CharSequence will return
 * {@code false}.
 * </p>
 *
 * <pre>
 * StringUtils.containsAny(null, *)            = false
 * StringUtils.containsAny("", *)              = false
 * StringUtils.containsAny(*, null)            = false
 * StringUtils.containsAny(*, "")              = false
 * StringUtils.containsAny("zzabyycdxx", "za") = true
 * StringUtils.containsAny("zzabyycdxx", "by") = true
 * StringUtils.containsAny("aba","z")          = false
 * </pre>
 *
 * @param cs
 *            the CharSequence to check, may be null
 * @param searchChars
 *            the chars to search for, may be null
 * @return the {@code true} if any of the chars are found, {@code false} if no match or null input
 * @since 2.4
 * @since 3.0 Changed signature from containsAny(String, String) to containsAny(CharSequence, CharSequence)
 */
public static boolean containsAny(CharSequence cs, CharSequence searchChars) {
    if (searchChars == null) {
        return false;
    }
    return containsAny(cs, CharSequenceUtils.toCharArray(searchChars));
}