Example usage for java.lang Character toLowerCase

List of usage examples for java.lang Character toLowerCase

Introduction

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

Prototype

public static int toLowerCase(int codePoint) 

Source Link

Document

Converts the character (Unicode code point) argument to lowercase using case mapping information from the UnicodeData file.

Usage

From source file:dev.maisentito.suca.commands.Hangman.java

public boolean isGuessed(char letter) {
    return (mGuessedChars.contains(Character.toLowerCase(letter)));
}

From source file:Main.java

/**
 * Green implementation of regionMatches.
 *
 * @param cs         the {@code CharSequence} to be processed
 * @param ignoreCase whether or not to be case insensitive
 * @param thisStart  the index to start on the {@code cs} CharSequence
 * @param substring  the {@code CharSequence} to be looked for
 * @param start      the index to start on the {@code substring} CharSequence
 * @param length     character length of the region
 * @return whether the region matched/*from w  w w .  j av a  2 s. c o m*/
 */
static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart,
        final CharSequence substring, final int start, final int length) {
    if (cs instanceof String && substring instanceof String) {
        return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
    }
    int index1 = thisStart;
    int index2 = start;
    int tmpLen = length;

    // Extract these first so we detect NPEs the same as the java.lang.String version
    final int srcLen = cs.length() - thisStart;
    final int otherLen = substring.length() - start;

    // Check for invalid parameters
    if (thisStart < 0 || start < 0 || length < 0) {
        return false;
    }

    // Check that the regions are long enough
    if (srcLen < length || otherLen < length) {
        return false;
    }

    while (tmpLen-- > 0) {
        final char c1 = cs.charAt(index1++);
        final char c2 = substring.charAt(index2++);

        if (c1 == c2) {
            continue;
        }

        if (!ignoreCase) {
            return false;
        }

        // The same check as in String.regionMatches():
        if (Character.toUpperCase(c1) != Character.toUpperCase(c2)
                && Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
            return false;
        }
    }

    return true;
}

From source file:StringUtils.java

private static String changeFirstCharacterCase(String str, boolean capitalize) {
    if (str == null || str.length() == 0) {
        return str;
    }/*from  w ww. j  a v a2s. co  m*/
    StringBuffer buf = new StringBuffer(str.length());
    if (capitalize) {
        buf.append(Character.toUpperCase(str.charAt(0)));
    } else {
        buf.append(Character.toLowerCase(str.charAt(0)));
    }
    buf.append(str.substring(1));
    return buf.toString();
}

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  w w w  .  j  a  v  a 2  s. c om
        last = c;
        sb.append(Character.toLowerCase(c));
    }

    return sb.toString();
}

From source file:com.tools.bi.TmpRender.java

private Map<String, Object> getEachHas(Class<?> clazz) {
    Map<String, Object> defaults = new HashMap<String, Object>();
    defaults.put("today", DateUtil.format(DateUtil.now()));
    defaults.put("year", DateUtil.format(DateUtil.now(), "yyyy"));
    String className = clazz.getSimpleName();
    defaults.put("ClassName", className);
    defaults.put("className", Character.toLowerCase(className.charAt(0)) + className.substring(1));
    return defaults;
}

From source file:com.velonuboso.made.core.interfaces.Archetype.java

/**
 * gets the name of the archetype.//from   www . ja  v a  2 s .c o m
 *
 * @return the name of the archetype
 */
public String getArchetypeName() {
    if (processedName == null) {
        StringBuilder stb = new StringBuilder();

        char[] arr = this.getClass().getSimpleName().toCharArray();
        for (int i = 0; i < arr.length; i++) {
            char aux = arr[i];
            if (Character.isUpperCase(aux)) {
                if (i == 0) {
                    stb.append(aux);
                } else {
                    stb.append(" ");
                    stb.append(Character.toLowerCase(aux));
                }
            } else {
                stb.append(aux);
            }
        }
        processedName = stb.toString();
    }
    return processedName;
}

From source file:org.github.aenygmatic.payroll.usecases.postprocessors.PaymentComponentEnumPostProcessor.java

@Override
protected String generateName(Class<?> interfaceType) {
    String s = PayType.class.getSimpleName() + interfaceType.getSimpleName() + "Proxy";
    return Character.toLowerCase(s.charAt(0)) + s.substring(1);
}

From source file:org.github.aenygmatic.payroll.usecases.postprocessors.EmployeeComponentEnumMapPostProcessor.java

@Override
protected String generateName(Class<?> interfaceType) {
    String s = EmployeeType.class.getSimpleName() + interfaceType.getSimpleName() + "Proxy";
    return Character.toLowerCase(s.charAt(0)) + s.substring(1);
}

From source file:org.clickframes.util.ClickframeUtils.java

public static String lowerCaseFirstChar(String description) {
    StringBuilder s = new StringBuilder(description);
    s.setCharAt(0, Character.toLowerCase(s.charAt(0)));
    return s.toString();
}

From source file:org.executequery.gui.text.TextUtilities.java

public static void changeSelectionToCamelCase(JTextComponent textComponent) {

    String selectedText = textComponent.getSelectedText();
    if (StringUtils.isBlank(selectedText)) {

        return;//from www.j  av  a  2 s  .com
    }

    String breakChars = "-_ \t";

    boolean nextIsUpper = false;
    StringBuilder sb = new StringBuilder();
    char[] chars = selectedText.toCharArray();
    for (int i = 0; i < chars.length; i++) {

        char _char = chars[i];
        if (breakChars.indexOf(_char) != -1) {

            if (i > 0) {

                nextIsUpper = true;
            }

        } else {

            if (nextIsUpper) {

                sb.append(Character.toUpperCase(_char));
                nextIsUpper = false;

            } else {

                sb.append(Character.toLowerCase(_char));
            }
        }
    }

    textComponent.replaceSelection(sb.toString());
}