本文整理汇总了Java中org.apache.commons.lang3.StringUtils.upperCase方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.upperCase方法的具体用法?Java StringUtils.upperCase怎么用?Java StringUtils.upperCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.upperCase方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSearchableTextOld
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
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);
}
示例2: transformCase
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* @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;
}
示例3: getSearchableText
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 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);
}
示例4: httpRequest
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
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;
}
示例5: getSearchableText
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* 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);
}
示例6: populateAlphas
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
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;
}
示例7: handleSingleStr
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
protected String handleSingleStr(String input) {
return StringUtils.upperCase(input);
}