Example usage for org.apache.commons.lang3 CharUtils isAsciiAlphaUpper

List of usage examples for org.apache.commons.lang3 CharUtils isAsciiAlphaUpper

Introduction

In this page you can find the example usage for org.apache.commons.lang3 CharUtils isAsciiAlphaUpper.

Prototype

public static boolean isAsciiAlphaUpper(final char ch) 

Source Link

Document

Checks whether the character is ASCII 7 bit alphabetic upper case.

 CharUtils.isAsciiAlphaUpper('a')  = false CharUtils.isAsciiAlphaUpper('A')  = true CharUtils.isAsciiAlphaUpper('3')  = false CharUtils.isAsciiAlphaUpper('-')  = false CharUtils.isAsciiAlphaUpper('\n') = false CharUtils.isAsciiAlphaUpper('©') = false 

Usage

From source file:io.wcm.handler.richtext.impl.DataPropertyUtil.java

/**
 * Converts a headless camel case property name to a HTML5 data attribute name including "data-" prefix.
 * @param headlessCamelCaseName Headless camel case name
 * @return HTML5 data attribute name/*from  w ww  .  j  av  a2s. c o m*/
 * @throws IllegalArgumentException If parameter name is not valid
 */
public static String toHtml5DataName(String headlessCamelCaseName) {
    if (StringUtils.isEmpty(headlessCamelCaseName)) {
        throw new IllegalArgumentException("Property name is empty.");
    }
    if (!isHeadlessCamelCaseName(headlessCamelCaseName)) {
        throw new IllegalArgumentException(
                "This is not a valid headless camel case property name: " + headlessCamelCaseName);
    }

    StringBuilder html5DataName = new StringBuilder(HTML5_DATA_PREFIX);
    for (int i = 0; i < headlessCamelCaseName.length(); i++) {
        char c = headlessCamelCaseName.charAt(i);
        if (CharUtils.isAsciiAlphaUpper(c)) {
            html5DataName.append('-');
        }
        html5DataName.append(Character.toLowerCase(c));
    }

    return html5DataName.toString();
}

From source file:me.gloriouseggroll.quorrabot.event.irc.message.IrcMessageEvent.java

public int getCapsCount() {
    int count = 0;
    for (int i = 0, l = message.length(); i < l; ++i) {
        if (CharUtils.isAsciiAlphaUpper(message.charAt(i))) {
            ++count;//ww  w . j a  v a  2 s  .c o  m
        }
    }
    return count;
}