本文整理汇总了Java中org.apache.commons.lang3.text.WordUtils.capitalizeFully方法的典型用法代码示例。如果您正苦于以下问题:Java WordUtils.capitalizeFully方法的具体用法?Java WordUtils.capitalizeFully怎么用?Java WordUtils.capitalizeFully使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.text.WordUtils
的用法示例。
在下文中一共展示了WordUtils.capitalizeFully方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modify
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
static String modify(String toModify, String modifier) {
switch (modifier) {
case ModifierTypes.LOWER:
return toModify.toLowerCase();
case ModifierTypes.UPPER:
return toModify.toUpperCase();
case ModifierTypes.FIRST_CAP:
return StrUtils.capitalizeFully(toModify);
case ModifierTypes.WORD_CAP:
return WordUtils.capitalizeFully(toModify);
case ModifierTypes.FIRST_CAP_SOFT:
return StringUtils.capitalize(toModify);
case ModifierTypes.WORD_CAP_SOFT:
return WordUtils.capitalize(toModify);
default:
return toModify;
}
}
示例2: addSnippets
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private void addSnippets(SearchResultBuilder result, SolrDocument document) {
List<String> snippets = new ArrayList<>();
if(highlights.get(document.get("id").toString()) != null) {
Map<String, List<String>> highlight = highlights.get(document.get("id"));
if(!highlight.isEmpty()) {
for(Entry<String, List<String>> entry : highlight.entrySet()) {
if(!entry.getValue().isEmpty()) {
if(fieldNames.containsKey(entry.getKey()) && !blacklist.contains(entry.getKey())) {
String key = WordUtils.capitalizeFully(fieldNames.get(entry.getKey()));
snippets.add(" <b>" + key + "</b>: " + entry.getValue().get(0));
}
}
}
}
}
if(snippets.isEmpty()){
snippets = defaultSnippet(document);
}
if(!snippets.isEmpty()){
result.snippet(Joiner.on("<br/>").join(snippets));
}
}
示例3: setSelectedType
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
public void setSelectedType(PkmType type) {
String toSelect = null;
if (type != null) {
if (shouldRebuild) {
refill();
}
toSelect = WordUtils.capitalizeFully(type.toString());
DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>) getModel();
if (model.getIndexOf(toSelect) == -1) {
shouldRebuild = true;
insertItemAt(toSelect, 0);
} else {
shouldRebuild = false;
}
}
setSelectedItem(toSelect);
}
示例4: toClassName
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private String toClassName(String theValue) {
StringBuilder b = new StringBuilder();
for (String next : theValue.split("\\s+")) {
next = next.trim();
if (StringUtils.isBlank(next)) {
continue;
}
if (next.startsWith("(") && next.endsWith(")")) {
continue;
}
next = next.replace("/", "");
next = next.replace("-", "");
next = next.replace(',', '_');
next = next.replace('.', '_');
if (next.contains(" ")) {
next = WordUtils.capitalizeFully(next);
}
b.append(next);
}
b.append("Enum");
return b.toString();
}
示例5: getDisplayName
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private String getDisplayName(final Entity entity) {
Preconditions.checkNotNull((Object) entity, "Entity cannot be null");
if(entity instanceof Player) {
final Player player = (Player) entity;
return player.getName() + ChatColor.DARK_RED + '[' + ChatColor.DARK_RED + this.plugin.getUserManager().getUser(player.getUniqueId()).getKills() + ChatColor.DARK_RED + ']';
}
return WordUtils.capitalizeFully(entity.getType().name().replace('_', ' '));
}
示例6: setupSharedInfo
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private void setupSharedInfo() {
if((getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_SEND))
|| (getIntent().getAction() != null && getIntent().getAction().equals(NfcAdapter.ACTION_NDEF_DISCOVERED)
|| (getIntent().getType() != null && getIntent().getType().equals("text/plain")))
|| getIntent().getDataString() != null) {
String data;
if(getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_SEND)) {
data = getIntent().getStringExtra(Intent.EXTRA_TEXT);
} else {
data = getIntent().getDataString();
}
if(Patterns.WEB_URL.matcher(data).matches()) {
Uri received = Uri.parse(data);
Uri instance = Uri.parse(BuildConfig.SERVER_BASE_URL);
if(received.getHost().equals(instance.getHost())) {
if(received.getPathSegments().size() == 2 && received.getPathSegments().get(1) != null && !received.getPathSegments().get(1).equals("")) {
id = received.getPathSegments().get(1);
}
} else if(received.getHost().equals("www.pathe.nl")) {
if(received.getPathSegments().size() >= 2
&& received.getPathSegments().get(0) != null && received.getPathSegments().get(0).equals("film")
&& received.getPathSegments().get(1) != null && !received.getPathSegments().get(1).equals("")) {
sharedMovieID = Integer.parseInt(received.getPathSegments().get(1));
if(received.getPathSegments().size() >= 3 && received.getPathSegments().get(2) != null
&& !received.getPathSegments().get(2).equals("")) {
sharedTitle = WordUtils.capitalizeFully(received.getPathSegments().get(2).replace("-", " "));
}
}
}
}
}
}
示例7: convertToCamelCase
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private static String convertToCamelCase(final String inString) {
String str = inString.trim();
if (StringUtils.contains(str, '-') || StringUtils.contains(str, ' ')) {
str = inString.replace('-', ' ');
str = WordUtils.capitalizeFully(str);
str = StringUtils.deleteWhitespace(str);
}
return StringUtils.uncapitalize(str);
}
示例8: getDeviceName
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
/**
* Print a user-friendly name for a MFA device
* @param factor Okta MFA factor
* @return Device name
*/
protected String getDeviceName(final Factor factor) {
Preconditions.checkArgument(factor != null, "factor cannot be null.");
final String factorProvider = factor.getProvider().toLowerCase();
if (MFA_FACTOR_NAMES.containsKey(factorProvider)) {
return MFA_FACTOR_NAMES.get(factorProvider);
}
return WordUtils.capitalizeFully(factorProvider);
}
示例9: bindMarketOrderView
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private void bindMarketOrderView(MarketOrder order, MarketOrderHolder holder) {
DecimalFormat formatter;
String price;
formatter = new DecimalFormat("#,###.00");
price = formatter.format(order.getPrice()) + " ISK";
formatter = new DecimalFormat("#,###");
String volume = formatter.format(order.getVolume());
holder.location.setText(order.getLocation());
holder.price.setText(price);
holder.volume.setText(volume);
if (order.isBuyOrder()) {
String range = order.getRange();
holder.rangeContainer.setVisibility(View.VISIBLE);
if (StringUtils.isNumeric(range)) {
range = range + " Jumps";
}
range = WordUtils.capitalizeFully(range);
holder.range.setText(range);
}
else {
holder.rangeContainer.setVisibility(View.GONE);
}
}
示例10: childRank
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
public CharSequence childRank(Taxon taxon, Options options) {
int index = Arrays.asList(Rank.LINNEAN_RANKS).indexOf(taxon.getTaxonRank());
if(taxon.getTaxonRank() == Rank.FAMILY) {
return "Genera";
} else if(index == -1) {
return "Unknown Rank";
} else if(index == Rank.LINNEAN_RANKS.length - 1) {
return "Infraspecifics";
} else {
return WordUtils.capitalizeFully(Rank.LINNEAN_RANKS[index+1].toString());
}
}
示例11: addResult
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private void addResult(SolrDocument document) {
SearchResultBuilder result = new SearchResultBuilder()
.url("/taxon/" + getStr(document, "taxon.identifier_s"))
.name(getStr(document, "taxon.scientific_name_s_lower"))
.accepted(getBool(document, "taxon.looks_accepted_b"))
.author(getStr(document, "taxon.scientific_name_authorship_s_lower"))
.kingdom(getStr(document, "taxon.kingdom_s_lower"));
if(!getBool(document, "taxon.is_accepted_b") && document.containsKey("taxon.accepted.identifier_s")) {
SearchResultBuilder synonym = new SearchResultBuilder()
.url("/taxon/" + document.get("taxon.accepted.identifier_s"))
.name(getStr(document, "taxon.accepted.scientific_name_s"))
.accepted(true)
.author(getStr(document, "taxon.accepted.scientific_name_authorship_s"))
.kingdom(getStr(document, "taxon.accepted.kingdom_s"));
result.synonymOf(synonym);
}
if(document.get("taxon.rank_s_lower") != null) {
String rank = WordUtils.capitalizeFully((String)document.get("taxon.rank_s_lower"));
result.rank(rank);
}
for(int i = 1; i <= 3; i++) {
if(document.containsKey("taxon.image_" + i + "_thumbnail_s")) {
result.addImage(
getStr(document, "taxon.image_" + i + "_thumbnail_s"),
getStr(document, "taxon.image_" + i + "_fullsize_s"),
getStr(document, "taxon.image_" + i + "_caption_s"));
} else {
break;
}
}
addSnippets(result, document);
jsonBuilder.addResult(result);
}
示例12: defaultSnippet
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private List<String> defaultSnippet(SolrDocument document){
List<String> snippets = new ArrayList<String>();
String defaultName = defaultCommonName(document);
String defaultDescription = defaultDescription(document);
if(defaultName != null){
logger.debug("adding default name");
String key = WordUtils.capitalizeFully(fieldNames.get("taxon.vernacular_names_t"));
snippets.add(" <b>" + key + "</b>: " + defaultName);
}
if(defaultDescription != null){
snippets.add(" <b>Summary</b>: " + defaultDescription);
}
return snippets;
}
示例13: updateFlagSign
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private void updateFlagSign(int index) {
String title = JungleRaidFlag.values()[signScrollFlagStart + index].toString();
if (title.length() > 15) {
title = title.substring(0, 15);
}
title = WordUtils.capitalizeFully(title.replace("_", " "));
scrollingFlagSigns.get(index).getTileEntity().get().offer(Keys.SIGN_LINES, Lists.newArrayList(
Text.EMPTY,
Text.of(title),
Text.of(flagState[signScrollFlagStart + index] ? Text.of(TextColors.DARK_GREEN, "Enabled") : Text.of(TextColors.RED, "Disabled")),
Text.EMPTY
));
}
示例14: updateClassSign
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private void updateClassSign(int index) {
String title = JungleRaidClass.values()[signScrollClassStart + index].toString();
if (title.length() > 15) {
title = title.substring(0, 15);
}
title = WordUtils.capitalizeFully(title.replace("_", " "));
scrollingClassSigns.get(index).getTileEntity().get().offer(Keys.SIGN_LINES, Lists.newArrayList(
Text.EMPTY,
Text.of(title),
Text.EMPTY,
Text.EMPTY
));
}
示例15: rebuildSelectedLabel
import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private void rebuildSelectedLabel() {
String textToUse = getString(KEY_NONE_SELECTED);
if (selectedSpecies != null) {
String name = selectedSpecies.getLocalizedName();
RosterManager rosterManager = getUser().getRosterManager();
Integer thisLevel = rosterManager.getLevelForSpecies(selectedSpecies);
int attack = selectedSpecies.getAttack(thisLevel);
PkmType type = megaFilter.isSelected() ? selectedSpecies.getMegaType() : selectedSpecies.getType();
String typeNice = WordUtils.capitalizeFully(type.toString());
Effect effect = selectedSpecies.getEffect(getUser().getRosterManager());
String effectNice = EffectChooser.convertToBox(effect.toString());
textToUse = getString(KEY_SELECTED, name, attack, typeNice, effectNice);
}
selectedDisplayLabel.setText(textToUse);
}