Java Code Examples for org.apache.commons.lang3.StringUtils.upperCase()

The following are Jave code examples for showing how to use upperCase() of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: springboot-spwa-gae-demo   File: TextSearch.java   View Source Code Vote up 6 votes
public static String getSearchableTextOld(String... strings) {
    Set<String> allUppercaseSubstrings = new LinkedHashSet<>();

    for (String sourceString : strings) {
        String string = StringUtils.upperCase(StringUtils.trimToNull(sourceString));
        if (string != null) {

            // Firstly get all substrings including spaces so we get search term match as it is typed
            allUppercaseSubstrings.addAll(getAllSubstrings(string));

            // Now do the same per word so you can search for surname only for example
            for (String word : SPACE_SEPARATOR_PATTERN.split(string)) {
                Set<String> upperCaseSubstrings = getAllSubstrings(word.toUpperCase());
                allUppercaseSubstrings.addAll(upperCaseSubstrings);
            }
        }
    }
    return Joiner.on(" ").join(allUppercaseSubstrings);
}
 
Example 2
Project: sentry   File: CronExpressionDescriptor.java   View Source Code Vote up 6 votes
/**
 * @param description
 * @return
 */
private static String transformCase(String description, Options options) {
    String descTemp = description;
    switch (options.getCasingType()) {
        case Sentence:
            descTemp = StringUtils.upperCase("" + descTemp.charAt(0)) + descTemp.substring(1);
            break;
        case Title:
            descTemp = StringUtils.capitalize(descTemp);
            break;
        default:
            descTemp = descTemp.toLowerCase();
            break;
    }
    return descTemp;
}
 
Example 3
Project: googlecloud-techtalk   File: TextSearch.java   View Source Code Vote up 6 votes
/**
 * Generates all substring permutations of one or more input strings, intended to be used as a search index to facilitate partial string searching.
 * See unit test and/or monash-thesis-submission Submission.getSearchableText() and SubmissionRepository.search() for an example of how this is used and searched on
 *
 * NOTE: To allow searches to firstly match on partial or full term including spaces the first thing we do is take the whole string and all permutations down from it. Then we do words.
 *
 */
public static String getSearchableText(String... strings) {
    Set<String> allUppercaseSubstrings = new LinkedHashSet<>();

    for (String sourceString : strings) {
        String string = StringUtils.upperCase(StringUtils.trimToNull(sourceString));
        if (string != null) {

            // Firstly get all substrings including spaces so we get search term match as it is typed
            allUppercaseSubstrings.addAll(getAllSubstrings(string));

            // Now do the same per word so you can search for surname only for example
            for (String word : SPACE_SEPARATOR_PATTERN.split(string)) {
                Set<String> upperCaseSubstrings = getAllSubstrings(word.toUpperCase());
                allUppercaseSubstrings.addAll(upperCaseSubstrings);
            }
        }
    }
    return Joiner.on(" ").join(allUppercaseSubstrings);
}
 
Example 4
Project: AppleSeed   File: TextSearch.java   View Source Code Vote up 6 votes
/**
 * Generates all substring permutations of one or more input strings, intended to be used as a search index to facilitate partial string searching.
 * See unit test and/or monash-thesis-submission Submission.getSearchableText() and SubmissionRepository.search() for an example of how this is used and searched on
 *
 * NOTE: To allow searches to firstly match on partial or full term including spaces the first thing we do is take the whole string and all permutations down from it. Then we do words.
 *
 */
public static String getSearchableText(String... strings) {
    Set<String> allUppercaseSubstrings = new LinkedHashSet<>();

    for (String sourceString : strings) {
        String string = StringUtils.upperCase(StringUtils.trimToNull(sourceString));
        if (string != null) {

            // Firstly get all substrings including spaces so we get search term match as it is typed
            allUppercaseSubstrings.addAll(getAllSubstrings(string));

            // Now do the same per word so you can search for surname only for example
            for (String word : SPACE_SEPARATOR_PATTERN.split(string)) {
                Set<String> upperCaseSubstrings = getAllSubstrings(word.toUpperCase());
                allUppercaseSubstrings.addAll(upperCaseSubstrings);
            }
        }
    }
    return Joiner.on(" ").join(allUppercaseSubstrings);
}
 
Example 5
Project: mafia   File: HttpUtil.java   View Source Code Vote up 6 votes
private static String httpRequest(String url, Object data, String method, int timeoutMilliseconds/*毫秒*/, int retryTimes) {
    Preconditions.checkArgument(retryTimes <= 10 && retryTimes >= 0, "retryTimes should between 0(include) and 10(include)");
    method = StringUtils.upperCase(method);
    Preconditions.checkArgument(HttpMethod.resolve(method) != null, "http request method error");
    try {
        HttpRequest request = getHttpRequest(url, data, method);
        long start = System.currentTimeMillis();
        String uuid = StringUtils.left(UUID.randomUUID().toString(), 13);
        logger.info("UUID:{}, Request URL:{} , method:{}, Request data:{}", uuid, url, method, JsonUtil.writeValueQuite(data));
        request.setNumberOfRetries(retryTimes);
        request.setConnectTimeout(timeoutMilliseconds);
        request.setLoggingEnabled(LOGGING_ENABLED);
        HttpResponse response = request.execute();
        response.setLoggingEnabled(LOGGING_ENABLED);
        InputStream in = new BufferedInputStream(response.getContent());
        String res = StreamUtils.copyToString(in, Charsets.UTF_8);
        logger.info("UUID:{}, Request cost [{}ms], Response data:{}", uuid, (System.currentTimeMillis() - start), res);
        return res;
    } catch (IOException e) {
        logger.warn("Http request error", e);
    }
    return StringUtils.EMPTY;
}
 
Example 6
Project: springboot-spwa-gae-demo   File: TextSearch.java   View Source Code Vote up 5 votes
/**
 * Generates all substring permutations of one or more input strings, intended to be used as a search index to facilitate partial string searching.
 * See unit test and/or monash-thesis-submission Submission.getSearchableText() and SubmissionRepository.search() for an example of how this is used and searched on
 *
 * NOTE: To allow searches to firstly match on partial or full term including spaces the first thing we do is take the whole string and all permutations down from it. Then we do words.
 *
 */
public static String getSearchableText(String... strings) {
    Set<String> allUppercaseSubstrings = new LinkedHashSet<>();

    for (String sourceString : strings) {
        String string = StringUtils.upperCase(StringUtils.trimToNull(sourceString));
        if (string != null) {
            allUppercaseSubstrings.addAll(getAllSubstrings(string));
        }
    }
    return Joiner.on(" ").join(allUppercaseSubstrings);
}
 
Example 7
Project: nixmash-blog   File: PostDTO.java   View Source Code Vote up 5 votes
private static PostDTO populateAlphas(Post post, Boolean isAlphabetic) {
    PostDTO built = new PostDTO();
    String postTitle = post.getPostTitle();
    String alphaKey = StringUtils.upperCase(substring(postTitle, 0, 1));
    if (!isAlphabetic) {
        alphaKey = ALPHACODE_09;
    }

    built.postTitle = postTitle;
    built.postName = post.getPostName();
    built.alphaKey = alphaKey;
    return built;
}
 
Example 8
Project: vscrawler   File: UpperCase.java   View Source Code Vote up 4 votes
@Override
protected String handleSingleStr(String input) {
    return StringUtils.upperCase(input);
}