Example usage for org.apache.commons.lang CharUtils isAsciiAlphaLower

List of usage examples for org.apache.commons.lang CharUtils isAsciiAlphaLower

Introduction

In this page you can find the example usage for org.apache.commons.lang CharUtils isAsciiAlphaLower.

Prototype

public static boolean isAsciiAlphaLower(char ch) 

Source Link

Document

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

Usage

From source file:net.ravendb.client.RavenDBAwareTests.java

protected String getDbName() {
    String method = testName.getMethodName();
    StringBuilder dbName = new StringBuilder();
    if (method.length() > 15) {
        dbName.append(method.substring(0, 10));
        for (int i = 10; i < method.length() - 2; i++) {
            if (CharUtils.isAsciiAlphaUpper(method.charAt(i))) {
                dbName.append(method.charAt(i));
                if (CharUtils.isAsciiAlphaLower(method.charAt(i + 1))) {
                    dbName.append(method.charAt(i + 1));
                }/*  w  w w .  jav a2 s  .  c om*/
            }
            if ('_' == method.charAt(i)) {
                dbName.append(CharUtils.toString(method.charAt(i + 1)).toUpperCase());
                dbName.append(method.charAt(i + 2));
                i++;
            }
        }
    } else {
        return method;
    }
    return dbName.toString();
}

From source file:org.intermine.sql.DatabaseUtil.java

/**
 * Check that a column name provided to us is a legal column name, to prevent SQL injection.
 * @param name The desired column name.//  ww w  .  j  av  a  2  s  .c  o m
 * @return Whether or not we should accept it.
 */
protected static boolean isLegalColumnName(String name) {
    if (StringUtils.isEmpty(name)) {
        return false;
    }
    boolean isValid = true;
    for (int i = 0; i < name.length(); i++) {
        char c = name.charAt(i);
        isValid = isValid && (CharUtils.isAsciiAlphaLower(c) || CharUtils.isAsciiNumeric(c) || c == '_');
    }
    return isValid;
}