Example usage for com.google.common.base CharMatcher or

List of usage examples for com.google.common.base CharMatcher or

Introduction

In this page you can find the example usage for com.google.common.base CharMatcher or.

Prototype

public CharMatcher or(CharMatcher other) 

Source Link

Document

Returns a matcher that matches any character matched by either this matcher or other .

Usage

From source file:apps.Source2XML.java

/**
 * //from www .  j a v a  2s. c  o m
 * A good word should start from the letter: it may contain a letter,
 * a dash, or an apostrophe. 
 * 
 * @param text        input
 *     
 * @return true if a good word.
 */
protected static boolean isGoodWord(String text) {
    if (text.isEmpty())
        return false;
    // 
    CharMatcher m = (CharMatcher.JAVA_LETTER_OR_DIGIT).and(CharMatcher.ASCII);
    m = m.or(CharMatcher.is('-'));
    m = m.or(CharMatcher.is('\''));

    return m.matchesAllOf(text);
}

From source file:org.jboss.as.console.client.core.Header.java

private String logoName(String productName) {
    CharMatcher digits = CharMatcher.inRange('0', '9');
    CharMatcher alpha = CharMatcher.inRange('a', 'z');
    return digits.or(alpha).retainFrom(productName.toLowerCase());
}