Example usage for java.lang Character isUpperCase

List of usage examples for java.lang Character isUpperCase

Introduction

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

Prototype

public static boolean isUpperCase(int codePoint) 

Source Link

Document

Determines if the specified character (Unicode code point) is an uppercase character.

Usage

From source file:com.careerly.utils.TextUtils.java

/**
 * ?a-zA-Z0-9/*from   ww w.j ava2s . c om*/
 *
 * @param ch ?
 * @return  true
 */
public static boolean isDigitOrEngilishChar(char ch) {
    return Character.isLowerCase(ch) || Character.isUpperCase(ch) || Character.isDigit(ch);
}

From source file:org.moe.natjgen.CEnumManager.java

private static boolean isUpperCaseOrNumber(String str) {
    for (int i = 0; i < str.length(); ++i) {
        char c = str.charAt(i);
        if (Character.isDigit(c))
            continue;
        if (Character.isUpperCase(c))
            continue;
        return false;
    }/* w w w . ja v a 2  s.  c om*/
    return true;
}

From source file:com.nokia.ci.integration.sqlImport.SqlSplitter.java

/**
 * @param c the char to check//from  www  . ja  v a  2 s.  c o m
 * @return <code>true</code> if the given character is either a lower or an upperchase alphanumerical character
 */
private static boolean isAlpha(char c) {
    return Character.isUpperCase(c) || Character.isLowerCase(c);
}

From source file:ISMAGS.CommandLineInterface.java

public static Motif getMotif(String motifspec, HashMap<Character, LinkType> typeTranslation) {
    int l = motifspec.length();
    int nrNodes = (int) Math.ceil(Math.sqrt(2 * l));
    int l2 = nrNodes * (nrNodes - 1) / 2;
    if (l != l2) {
        Die("Error: motif \"" + motifspec + "\" has invalid length");
    }/*www .ja  v  a  2 s  . c o  m*/
    int counter = 0;
    Motif m = new Motif(nrNodes);
    for (int i = 1; i < nrNodes; i++) {
        for (int j = 0; j < i; j++) {
            //                System.out.println("("+(1+i)+","+(1+j)+")");
            char c = motifspec.charAt(counter);
            counter++;
            if (c == '0') {
                continue;
            }
            LinkType lt = typeTranslation.get(Character.toUpperCase(c));
            if (Character.isUpperCase(c)) {
                m.addMotifLink(j, i, lt);
            } else {
                m.addMotifLink(i, j, lt);
            }
        }
    }
    m.finaliseMotif();
    return m;
}

From source file:org.jiemamy.utils.JmStringUtil.java

/**
 * JavaBeans????????/*from w w  w . ja  v a2  s .co  m*/
 * 
 * <p>?2??????????????</p>
 * 
 * @param name ???
 * @return ???{@code name}?????????
 */
public static String decapitalizeAsJavaBeans(String name) {
    if (isEmpty(name)) {
        return name;
    }
    char[] chars = name.toCharArray();
    if (chars.length >= 2 && Character.isUpperCase(chars[0]) && Character.isUpperCase(chars[1])) {
        return name;
    }
    chars[0] = Character.toLowerCase(chars[0]);
    return new String(chars);
}

From source file:com.insprise.common.lang.StringUtilities.java

/**
  * Tokenize the given Java identifier into parts that form it.
  * @param identifier e.g., 'userName' will result ['user', 'Name'].
  * @return/*w  w  w.j a  va  2 s .  c  o m*/
  */
 public static String[] tokenizeIdentifierIntoArray(String identifier) {
     StringBuilder sb = new StringBuilder();
     boolean lastIsUpper = false;
     for (int i = 0; i < identifier.length(); i++) {
         char c = identifier.charAt(i);
         if (i == 0) {
             sb.append(c);
             lastIsUpper = Character.isUpperCase(c);
             continue;
         }

         if (Character.isUpperCase(c)) {
             if (lastIsUpper) { // HTT
                 // continue of all upper
             } else { // fileH -> new part.
                 sb.append(";");
             }
             sb.append(c);
             lastIsUpper = true;
         } else {
             sb.append(c);
             lastIsUpper = false;
         }
     }

     return tokenizeStringIntoArray(sb.toString(), ";");
 }

From source file:org.eclim.plugin.jdt.command.junit.JUnitUtils.java

private static void appendParameterNamesToMethodName(StringBuffer buffer, String[] parameters) {
    for (String parameter : parameters) {
        final StringBuffer buf = new StringBuffer(
                Signature.getSimpleName(Signature.toString(Signature.getElementType(parameter))));
        final char character = buf.charAt(0);
        if (buf.length() > 0 && !Character.isUpperCase(character)) {
            buf.setCharAt(0, Character.toUpperCase(character));
        }// ww w  .  j  a v  a  2  s .  co m
        buffer.append(buf.toString());
        for (int j = 0, arrayCount = Signature.getArrayCount(parameter); j < arrayCount; j++) {
            buffer.append("Array");
        }
    }
}

From source file:org.intermine.common.swing.text.RestrictedInputDocument.java

/**
 * Insert the given text into this document, as long as it leaves the document valid.
 * // w ww. j  a v a  2 s .  c  o  m
 * @param offset The starting offset &gt;= 0.
 * @param str The string to insert; does nothing with null/empty strings.
 * @param attr The attributes for the inserted content.
 * 
 * @throws BadLocationException if the given insert position is not a valid
 * position within the document.
 *   
 * @see javax.swing.text.Document#insertString
 */
@Override
public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException {
    if (str == null) {
        return;
    }

    if (limit < 0 || getLength() + str.length() <= limit) {
        if (convertArray == null || convertArray.length < str.length()) {
            convertArray = new char[str.length()];
        }

        CharacterIterator iter = new StringCharacterIterator(str);
        char c = iter.first();
        int index;
        for (index = 0; c != CharacterIterator.DONE; c = iter.next()) {
            if (!overrideChecks && !StringUtils.contains(allowableCharacters, c)) {

                // At this point, c is invalid. See if a case change remedies this.

                if (caseConvert && Character.isLetter(c)) {
                    if (Character.isLowerCase(c)) {
                        c = Character.toUpperCase(c);
                    } else if (Character.isUpperCase(c)) {
                        c = Character.toLowerCase(c);
                    }
                    if (!StringUtils.contains(allowableCharacters, c)) {
                        // Don't insert but otherwise ignore.
                        return;
                    }
                } else {
                    return;
                }
            }
            convertArray[index++] = c;

        }
        super.insertString(offset, new String(convertArray, 0, index), attr);
    }
}

From source file:it.scoppelletti.programmerpower.web.control.ActionBase.java

/**
 * Inizializza la base del nome delle operazioni dell&rsquo;azione;.
 * //w w w  .  ja  v a2 s. c  om
 * @return Valore.
 */
protected String initActionNameBase() {
    char c;
    String value;

    value = getClass().getSimpleName();
    if (Strings.isNullOrEmpty(value)) {
        return "";
    }

    if (value.endsWith(ActionBase.ACTION_SUFFIX)) {
        value = value.substring(0, value.length() - ActionBase.ACTION_SUFFIX.length());
        if (value.isEmpty()) {
            return "";
        }
    }

    c = value.charAt(0);
    if (Character.isUpperCase(c)) {
        value = String.valueOf(Character.toLowerCase(c)).concat(value.substring(1));
    }

    return value;
}

From source file:com.careerly.utils.TextUtils.java

/**
 * ?a-zA-Z/*from   www. j av  a  2s  .co  m*/
 *
 * @param ch ?
 * @return true
 */
public static boolean isEnglishChar(char ch) {
    return Character.isLowerCase(ch) || Character.isUpperCase(ch);
}