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: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 .ja v a2 s  .  co m*/
    }
    return -1;
}

From source file:org.seasar.dbflute.logic.replaceschema.schemainitializer.DfSchemaInitializerPostgreSQL.java

protected boolean needsQuotedForeignKeyName(String foreignKeyName) {
    final char[] charArray = foreignKeyName.toCharArray();
    for (int i = 0; i < charArray.length; i++) {
        if (Character.isUpperCase(charArray[i])) { // e.g. Fk_Vendor_ForeignKey_NAME_CaseCrisis
            return true;
        }/*from   w  w  w.ja v  a 2 s .  co m*/
    }
    return false;
}

From source file:org.hako.dao.mapper.AnnotationMapper.java

/**
 * Convert property name to dash separated column name.
 * {@code dateCreated => date_created}.
 * /*from   w  w  w  . j  a  v a 2 s .c  o  m*/
 * @param propertyName property name
 * @return dash separated name
 */
String toDashSeparated(String propertyName) {
    StringBuilder builder = new StringBuilder();
    for (char c : propertyName.toCharArray()) {
        if (Character.isUpperCase(c)) {
            builder.append('_').append(Character.toLowerCase(c));
        } else {
            builder.append(c);
        }
    }
    return builder.toString();
}

From source file:org.languagetool.rules.de.DashRule.java

@Override
public RuleMatch[] match(AnalyzedSentence sentence) {
    List<RuleMatch> ruleMatches = new ArrayList<>();
    AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace();
    String prevToken = null;/*from   w w w. j a v a  2 s  .c  o  m*/
    for (int i = 0; i < tokens.length; i++) {
        String token = tokens[i].getToken();
        if (prevToken != null && prevToken.endsWith("-") && !prevToken.equals("-") && !prevToken.contains("--")
                && !prevToken.contains("-") // first char is some special kind of dash, found in Wikipedia
        ) {
            char firstChar = token.charAt(0);
            if (Character.isUpperCase(firstChar)) {
                if (!StringUtils.equalsAny(token, "UND", "ODER", "BZW")) { // ignore "NORD- UND SDKOREA"
                    String msg = "Mglicherweise fehlt ein 'und' oder ein Komma, oder es wurde nach dem Wort "
                            + "ein berflssiges Leerzeichen eingefgt. Eventuell haben Sie auch versehentlich einen Bindestrich statt eines Punktes eingefgt.";
                    String shortMsg = "Fehlendes 'und' oder Komma oder berflssiges Leerzeichen?";
                    int fromPos = tokens[i - 1].getStartPos();
                    RuleMatch ruleMatch = new RuleMatch(this, sentence, fromPos,
                            fromPos + prevToken.length() + 1, msg, shortMsg);
                    String prevTokenStr = tokens[i - 1].getToken();
                    ruleMatch.setSuggestedReplacements(Arrays.asList(prevTokenStr, prevTokenStr + ", "));
                    ruleMatches.add(ruleMatch);
                }
            }
        }
        prevToken = token;
    }
    return toRuleMatchArray(ruleMatches);
}

From source file:org.hippoecm.frontend.plugins.yui.javascript.Setting.java

private String toConfigKey(String camelKey) {
    StringBuilder b = new StringBuilder(camelKey.length() + 4);
    for (char ch : camelKey.toCharArray()) {
        if (Character.isUpperCase(ch)) {
            b.append('.').append(Character.toLowerCase(ch));
        } else {/*from   w  ww .ja v  a2s .  co m*/
            b.append(ch);
        }
    }
    return b.toString();
}

From source file:com.haulmont.cuba.core.config.ConfigUtil.java

/**
 * Uncapitalize a string with support for leading acronyms. This
 * supports pretty uncapitalization of strings such as "URL" (to
 * "url") and "URLDecoder" (to "urlDecoder"). If a string begins with
 * a sequence of capital letters, all but the last are uncapitalized,
 * except in the case that the entire string is capitalized or the
 * capitals are followed by a non-letter, in which case all are
 * uncapitalized./*from  ww  w.j  a  v  a2  s .  c  o  m*/
 *
 * @param str The string.
 * @return The uncapitalized string.
 */
public static String extendedUncapitalize(String str) {
    // fooBar -> fooBar
    // FooBar -> fooBar
    // FOOBar -> fooBar
    // FOOBAR -> foobar
    // FOO8ar -> foo8ar
    int index = 0, length = str.length();
    while ((index < length) && Character.isUpperCase(str.charAt(index))
            && ((index == 0) || (index == length - 1) || !Character.isLowerCase(str.charAt(index + 1)))) {
        ++index;
    }
    return str.substring(0, index).toLowerCase() + str.substring(index);
}

From source file:net.hillsdon.reviki.vc.impl.ConfigPageCachingPageStore.java

static boolean isConfigPage(final String pageName) {
    return pageName.startsWith(CONFIG_PREFIX) && pageName.length() > CONFIG_PREFIX.length()
            && Character.isUpperCase(pageName.charAt(CONFIG_PREFIX.length()));
}

From source file:com.enitalk.controllers.bots.FillWordsRunnable.java

public void sendCandidates(String url, Integer type) {
    try {//from w  w w .  j a  v  a 2 s  .  co  m
        Response json = Request.Get(url).execute();
        String rs = json.returnContent().asString();
        JsonNode randomContent = jackson.readTree(rs);

        Iterator<JsonNode> els = randomContent.elements();
        while (els.hasNext()) {
            ObjectNode el = (ObjectNode) els.next();
            if (Character.isUpperCase(el.path("word").asText().charAt(0))
                    || StringUtils.contains(el.path("word").asText(), " ")) {
                els.remove();
            } else {
                el.put("type", type);
                rabbit.send("words", MessageBuilder.withBody(jackson.writeValueAsBytes(el)).build());
            }
        }

    } catch (Exception e) {
        logger.error(ExceptionUtils.getFullStackTrace(e));
    }
}

From source file:org.apache.fop.fonts.type1.Type1FontLoader.java

private String getPFMURI(String pfbURI) {
    String pfbExt = pfbURI.substring(pfbURI.length() - 3, pfbURI.length());
    String pfmExt = pfbExt.substring(0, 2) + (Character.isUpperCase(pfbExt.charAt(2)) ? "M" : "m");
    return pfbURI.substring(0, pfbURI.length() - 4) + "." + pfmExt;
}

From source file:org.ng200.openolympus.resourceResolvers.OpenOlympusMessageSource.java

private void reportMissingLocalisationKey(final String code) {
    try {//from w w w .jav  a 2 s.c o  m
        if (code.isEmpty() || Character.isUpperCase(code.charAt(0))) {
            return;
        }
        final Path file = FileSystems.getDefault().getPath(this.storagePath, "missingLocalisation.txt");
        if (!FileAccess.exists(file)) {
            FileAccess.createDirectories(file.getParent());
            FileAccess.createFile(file);
        }
        final Set<String> s = new TreeSet<>(Arrays.asList(FileAccess.readUTF8String(file).split("\n")));
        s.add(code);
        FileAccess.writeUTF8StringToFile(file, s.stream().collect(Collectors.joining("\n")));
    } catch (final IOException e) {
        OpenOlympusMessageSource.logger.error("Couldn't add to missing key repo: {}", e);
    }
}