Example usage for java.lang Character isLowerCase

List of usage examples for java.lang Character isLowerCase

Introduction

In this page you can find the example usage for java.lang Character isLowerCase.

Prototype

public static boolean isLowerCase(int codePoint) 

Source Link

Document

Determines if the specified character (Unicode code point) is a lowercase character.

Usage

From source file:net.prasenjit.auth.validation.StrongPasswordValidator.java

/** {@inheritDoc} */
@Override//from  ww w  .j  a va  2s  .  com
public boolean isValid(String value, ConstraintValidatorContext context) {
    if (!StringUtils.hasText(value))
        return true;
    int upperCount = 0;
    int specialCount = 0;
    int lowerCount = 0;
    int numericCount = 0;
    for (int i = 0; i < value.length(); i++) {
        char current = value.charAt(i);
        if (Character.isDigit(current))
            numericCount = 1;
        if (Character.isUpperCase(current))
            upperCount = 1;
        if (Character.isLowerCase(current))
            lowerCount = 1;
        if (!Character.isLetterOrDigit(current))
            specialCount = 1;
    }
    return upperCount + lowerCount + numericCount + specialCount >= 2;
}

From source file:org.elasticsearch.spark.sql.Utils.java

static String camelCaseToDotNotation(String string) {
    StringBuilder sb = new StringBuilder();

    char last = 0;
    for (int i = 0; i < string.length(); i++) {
        char c = string.charAt(i);
        if (Character.isUpperCase(c) && Character.isLowerCase(last)) {
            sb.append(".");
        }//from ww  w.  j  a  v  a 2s .  com
        last = c;
        sb.append(Character.toLowerCase(c));
    }

    return sb.toString();
}

From source file:org.eclipse.php.internal.core.documentModel.parser.AbstractPhpLexer.java

protected static final boolean isLowerCase(final String text) {
    if (text == null)
        return false;
    for (int i = 0; i < text.length(); i++)
        if (!Character.isLowerCase(text.charAt(i)))
            return false;
    return true;//from   w w  w  .  j  a  va 2s .  co  m
}

From source file:com.autentia.common.util.PasswordUtils.java

private static boolean atLeastOneCapitalLetter(String pwd) {
    final char[] pwdChars = pwd.toCharArray();
    for (int i = 0; i < pwdChars.length; i++) {
        if (Character.isLowerCase(pwdChars[i])) {
            return true;
        }//from  w ww . ja v  a2 s. c o m
    }
    return false;
}

From source file:org.ourbeehive.mbp.util.JavaFormatter.java

public static String getDbStyle(String javaPhrase) {

    // The return value.
    StringBuffer javaWord = new StringBuffer();
    StringBuffer dbPhrase = new StringBuffer();
    String dbWord = null;/*from w w  w  .  jav a 2s  .  c  om*/

    // Get "javaNameToDbName" cache from ctxCache.
    // Hashtable<String, String> javaNameToDbNameCache = CtxCacheFacade.getJavaNameToDbNameCache();

    int len = javaPhrase.length();
    char c = 0;
    for (int i = 0; i < len; i++) {

        c = javaPhrase.charAt(i);

        // Java Bean????"_"
        if (String.valueOf(c).equals(MapperElm.UNDER_LINE) == true) {
            continue;
        }

        if (Character.isLowerCase(c) == true || Character.isDigit(c) == true) {
            javaWord.append(c);
            if (i < len - 1) {
                continue;
            }
        }

        if (javaWord.length() != 0) {

            // Find corresponding dbWord with previous javaWord.
            // dbWord = javaNameToDbNameCache.get(javaWord.toString().toLowerCase());
            dbWord = javaWord.toString().toUpperCase();
            // if (dbWord != null) {
            if (dbPhrase.length() != 0) {
                dbPhrase.append(MapperElm.UNDER_LINE);
            }
            dbPhrase.append(dbWord);
        }

        // else {
        // // No need to look up others.
        // logger.warn("NO DB WORD: Fail to find corresponding DB word for " + "Java word '" + javaWord + "' in Java phrase '" + javaPhrase
        // + "'");
        // return null;
        // }

        // Begin a new javaWord.
        javaWord.delete(0, javaWord.length());
        if (Character.isUpperCase(c) == true) {
            javaWord.append(c);
        }

    }

    // javaWord.append(c);

    // Processing the last javaWord.
    // if (javaWord.length() != 0) {
    //
    // // Find corresponding dbWord with the last javaWord.
    // dbWord = fullNameToAbbrCache.get(javaWord.toString().toLowerCase());
    // if (dbWord != null) {
    // if (dbPhrase.length() != 0) {
    // dbPhrase.append(MapperElm.UNDER_LINE);
    // }
    // dbPhrase.append(dbWord);
    // } else {
    // // No need to look up others.
    // logger.warn("NO DB WORD: Fail to find corresponding DB word for " + "Java word '" + javaWord + "' in Java phrase '" + javaPhrase
    // + "'");
    // return null;
    // }
    // }

    return dbPhrase.toString();

}

From source file:org.openhie.openempi.util.ValidationUtil.java

public static Boolean isNormal(String str, boolean allowUnderscore, boolean allowLeadingDigit,
        boolean allowLowercase, boolean allowDash) {
    for (int ii = 0; ii < str.length(); ii++) {
        char ch = str.charAt(ii);
        if (ch == '_') { // allow underscore in certain cases
            if (ii == 0 || !allowUnderscore) { // but not as the first character
                return false;
            } else {
                continue;
            }/*www  .  j  av  a2 s.  c om*/
        }
        if (ch == '-') { // allow dash in certain cases
            if (ii == 0 || !allowDash) { // but not as the first character
                return false;
            } else {
                continue;
            }
        }
        if (!Character.isLetterOrDigit(ch))
            return false;
        if (!allowLowercase) {
            if (Character.isLowerCase(ch))
                return false;
        }
        if (!allowLeadingDigit && ii == 0 && Character.isDigit(ch)) // Do not allow digit as a leading character
            return false;
        if (Character.isWhitespace(ch))
            return false;
    }
    return true;
}

From source file:com.qtplaf.library.util.StringUtils.java

/**
 * Separates with a blank the different tokens that can compose a normal class or method name, like for instance
 * doSomething into Do something.//from   w  w w  .  j av  a  2  s  .c o m
 *
 * @param str The string to separate.
 * @return The separated string.
 */
public static String separeTokens(String str) {
    StringBuilder b = new StringBuilder();
    if (str != null) {
        for (int i = 0; i < str.length(); i++) {
            if (i == 0) {
                b.append(Character.toUpperCase(str.charAt(i)));
            } else {
                if (Character.isLowerCase(str.charAt(i - 1)) && Character.isUpperCase(str.charAt(i))) {
                    b.append(' ');
                    if ((i < str.length() - 1) && Character.isUpperCase(str.charAt(i + 1))) {
                        b.append(str.charAt(i));
                    } else {
                        b.append(Character.toLowerCase(str.charAt(i)));
                    }
                } else {
                    b.append(str.charAt(i));
                }
            }
        }
    }
    return b.toString();
}

From source file:org.paxml.bean.SplitTag.java

private final static int searchLowercase(String str, int since) {
    for (int i = since; i < str.length(); i++) {
        char c = str.charAt(i);
        if (Character.isLowerCase(c)) {
            return i;
        } else if (Character.isUpperCase(c)) {
            break;
        }//from   w  w w.j  av a  2 s .c om
    }
    return -1;
}

From source file:com.intellij.plugins.haxe.model.FullyQualifiedInfo.java

private FullyQualifiedInfo(ArrayList<String> parts) {
    StringBuilder packagePathBuilder = new StringBuilder();

    int i = 0;/*from   w  w w  .j  a v  a 2 s.  c o  m*/
    int size = parts.size();
    while (i < size) {
        String identifier = parts.get(i);
        if (identifier == null) {
            packagePath = null;
            fileName = null;
            memberName = null;
            className = null;
            return;
        }
        if (!Character.isLowerCase(identifier.charAt(0))) {
            break;
        }
        if (i > 0)
            packagePathBuilder.append(PATH_SEPARATOR);
        packagePathBuilder.append(identifier);

        i++;
    }

    packagePath = packagePathBuilder.toString();
    fileName = i < size ? parts.get(i++) : null;

    if (fileName == null) {
        className = null;
        memberName = null;
    } else {
        final String classOrMemberName = i < size ? parts.get(i++) : null;
        if (classOrMemberName != null && Character.isLowerCase(classOrMemberName.charAt(0))) {
            memberName = classOrMemberName;
            className = fileName;
        } else {
            className = classOrMemberName;
            memberName = i < size ? parts.get(i) : null;
        }
    }
}

From source file:org.languagetool.dev.dumpcheck.WikipediaSentenceExtractor.java

private boolean skipSentence(String sentence) {
    return sentence.trim().length() == 0 || Character.isLowerCase(sentence.trim().charAt(0));
}