本文整理汇总了Java中org.apache.commons.lang.WordUtils.capitalize方法的典型用法代码示例。如果您正苦于以下问题:Java WordUtils.capitalize方法的具体用法?Java WordUtils.capitalize怎么用?Java WordUtils.capitalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.WordUtils
的用法示例。
在下文中一共展示了WordUtils.capitalize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collect
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
public List<Method> collect(@NotNull Method psiElement) {
List<Method> results = new ArrayList<>();
PhpClass methodClass = psiElement.getContainingClass();
if (methodClass == null) {
return results;
}
List<PhpClass> pluginsList = pluginClassCache.getPluginsForClass(methodClass);
List<Method> pluginMethods = pluginClassCache.getPluginMethods(pluginsList);
String classMethodName = WordUtils.capitalize(psiElement.getName());
for (Method pluginMethod: pluginMethods) {
if (isPluginMethodName(pluginMethod.getName(), classMethodName)) {
results.add(pluginMethod);
}
}
return results;
}
示例2: ContextInstance
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public ContextInstance(String line, boolean noPosFlag) {
this.line = line;
String[] tokens = line.split("\t");
this.targetInd = Integer.parseInt(tokens[TARGET_INDEX]);
this.words = tokens[3].split(" ");
this.target = this.words[this.targetInd];
this.fullTargetKey = tokens[0];
this.pos = this.fullTargetKey.split(".")[this.fullTargetKey.split(".").length - 1];
String[] tmp = this.fullTargetKey.split(".");
this.targetKey = String.join(".", Arrays.asList(tmp[0], tmp[1])); // remove suffix in cases of bar.n.v
this.targetLemma = this.fullTargetKey.split(".")[0];
this.targetId = Integer.parseInt(tokens[1]);
if (validPOS.contains(this.pos)) this.pos = WordUtils.capitalize(this.pos);
if (noPosFlag) this.targetPos = String.join(".", Arrays.asList(this.target, "*"));
else this.targetPos = String.join(".", Arrays.asList(this.target, this.pos));
}
示例3: getPojoClassName
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
protected String getPojoClassName(String prefix, String suffix, String tableName) {
String className = tableName;
if (null != prefix && !prefix.isEmpty() && className.indexOf(prefix) == 0) {
className = className.replaceFirst(prefix, "");
}
if (null != suffix && !suffix.isEmpty()) {
className = className + WordUtils.capitalize(suffix);
}
StringBuilder result = new StringBuilder();
for (String str : StringUtils.split(className, "_")) {
result.append(WordUtils.capitalize(str));
}
return WordUtils.capitalize(result.toString());
}
示例4: getPojoClassName
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
protected String getPojoClassName(String prefix, String suffix, String table) {
String className = table;
if (null != prefix && !prefix.isEmpty() && className.indexOf(prefix) == 0) {
className = className.replaceFirst(prefix, "");
}
if (null != suffix && !suffix.isEmpty()) {
className = className + WordUtils.capitalize(suffix);
}
StringBuilder result = new StringBuilder();
for (String str : StringUtils.split(className, "_")) {
result.append(WordUtils.capitalize(str));
}
return WordUtils.capitalize(result.toString());
}
示例5: applyConversion
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
* Apply a case conversion to an input string
* @param source
* @return
*/
private String applyConversion(String source) {
String result = source;
// Find global property
if ("global".equalsIgnoreCase(caseConversion)) {
AdministrationService adminService = Context.getAdministrationService();
caseConversion = adminService.getGlobalProperty(OpenmrsConstants.GP_DASHBOARD_METADATA_CASE_CONVERSION);
}
// Apply conversion
if ("lowercase".equalsIgnoreCase(caseConversion)) {
result = StringUtils.lowerCase(result);
} else if ("uppercase".equalsIgnoreCase(caseConversion)) {
result = StringUtils.upperCase(result);
} else if ("capitalize".equalsIgnoreCase(caseConversion)) {
result = WordUtils.capitalize(StringUtils.lowerCase(result));
}
return result;
}
示例6: getCounty
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
* Extract the county from the Origin field
*
* @return
*/
public String getCounty()
{
String origin = this.getOrigin();
String[] parts = origin.split("__");
if(parts.length==4)
{
String county = parts[1].trim();
return WordUtils.capitalize(county.toLowerCase().replace("--", " - "));
}
log.error("Unable to extract County information from origin field from '"+this.getCatalogCode()+"'");
return null;
}
示例7: simpleManipulations
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private String simpleManipulations(String value, String manipulation) {
String result;
switch (manipulation) {
case "toupper":
result = value.toUpperCase();
break;
case "tolower":
result = value.toLowerCase();
break;
case "capitalize":
result = WordUtils.capitalize(value);
break;
case "urlencode":
try {
result = URLEncoder.encode(value, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new MotechException("URLEncode manipulator error.", e);
}
break;
default:
throw new MotechException("task.warning.manipulation");
}
return result;
}
示例8: translateGenre
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
* Translate Genre from config file.
*/
private String translateGenre(String genre){
if (settingsService == null) {
settingsService = new SettingsService();
}
if (settingsService.isOrganizeByGenreMap()) {
if (hmap.size() < 1) { readConfig(); }
String mappedGenre = hmap.get(genre);
if (mappedGenre != null) {
LOG.debug("## replaced Genre: " + genre + " -> " + mappedGenre);
return WordUtils.capitalize(mappedGenre);
}
return WordUtils.capitalize(genre);
} else {
return genre;
}
}
示例9: listStats
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private void listStats(Player player, StatType[] stats) {
String GRAY = ChatColor.GRAY.toString();
String DARK_AQUA = ChatColor.DARK_AQUA.toString();
String AQUA = ChatColor.AQUA.toString();
player.sendMessage(GRAY + "=========[ " + DARK_AQUA + _("INFO_COMMAND_STATS") + GRAY
+ " ]=========");
for (StatType stat : stats) {
if (stat == null)
continue;
String name = WordUtils.capitalize(stat.name().toLowerCase()
.replace('_', ' '));
player.sendMessage(DARK_AQUA + name + ": " + AQUA
+ manager.getStat(stat, player));
}
player.sendMessage(GRAY + "=========================");
}
示例10: getName
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public String getName() {
String name;
ItemMeta meta = item.getItemMeta();
if (meta.hasDisplayName()) {
name = meta.getDisplayName();
} else {
name = item.getType().name();
name = name.replace("_", " ").toLowerCase();
name = WordUtils.capitalize(name);
name += ChatColor.WHITE; // In case it's a wand
}
if (item.getAmount() > 1)
name = item.getAmount() + " " + name;
return name;
}
示例11: setPersonFields
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
protected void setPersonFields() {
final Person person = getDocumentRequest().getPerson();
addParameter("name", StringFormatter.prettyPrint(person.getName()));
addParameter("nameOfFather", StringFormatter.prettyPrint(person.getNameOfFather()));
addParameter("nameOfMother", StringFormatter.prettyPrint(person.getNameOfMother()));
String country;
String countryUpperCase;
if (person.getCountry() != null) {
countryUpperCase = person.getCountry().getCountryNationality().getContent(getLanguage()).toLowerCase();
country = WordUtils.capitalize(countryUpperCase);
} else {
throw new DomainException("error.personWithoutParishOfBirth");
}
String nationality = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "diploma.nationality");
addParameter("birthLocale", MessageFormat.format(nationality, country));
}
示例12: addPersonParameters
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private void addPersonParameters() {
final Person person = getDocumentRequest().getPerson();
addParameter("name", StringFormatter.prettyPrint(person.getName()));
addParameter("nameOfFather", StringFormatter.prettyPrint(person.getNameOfFather()));
addParameter("nameOfMother", StringFormatter.prettyPrint(person.getNameOfMother()));
String country;
String countryUpperCase;
if (person.getCountry() != null) {
countryUpperCase = person.getCountry().getCountryNationality().getContent(getLanguage()).toLowerCase();
country = WordUtils.capitalize(countryUpperCase);
} else {
throw new DomainException("error.personWithoutParishOfBirth");
}
String nationality = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "diploma.nationality");
addParameter("birthLocale", MessageFormat.format(nationality, country));
}
示例13: process
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
public String process( String input, Object rawLine )
{
if( input == null )
return null;
input = StringUtils.trim( input ).replaceAll( "[ ]{2,}", " " ).toLowerCase();
input = preProcess( input ).replaceAll( "[ ]{2,}", " " );
StringBuilder stringBuilder = new StringBuilder();
String[] tokens = input.split( "[ ]" );
for( String token : tokens )
{
stringBuilder.append( processToken( token ) );
stringBuilder.append( " " );
}
return WordUtils.capitalize( StringUtils.trim( stringBuilder.toString() ).replaceAll( "[ ]{2,}", " " ) );
}
示例14: getStdMethodName
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
static public String getStdMethodName(String str) {
String ret = "";
if (str != null) {
String[] temp = str.split("_");
for (int i = 0; i < temp.length; i++) {
ret += WordUtils.capitalize(temp[i]);
}
}
return ret;
}
示例15: service
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
req.setCharacterEncoding("Shift_JIS");
res.setContentType("text/html; charset=UTF-8");
try {
String string = req.getParameter("string");
Locale locale = req.getLocale();
StringBuilder bodyHtml = new StringBuilder();
bodyHtml.append("<form action=\"mojibake\" method=\"post\">");
bodyHtml.append(getMsg("description.capitalize.string", locale));
bodyHtml.append("<br><br>");
bodyHtml.append(getMsg("label.string", locale) + ": ");
bodyHtml.append("<input type=\"text\" name=\"string\" size=\"100\" maxlength=\"100\">");
bodyHtml.append("<br><br>");
bodyHtml.append("<input type=\"submit\" value=\"" + getMsg("label.submit", locale) + "\">");
bodyHtml.append("<br><br>");
if (string != null && !"".equals(string)) {
// Capitalize the given string
String capitalizeName = WordUtils.capitalize(string);
bodyHtml.append(getMsg("label.capitalized.string", locale) + " : " + encodeForHTML(capitalizeName));
} else {
bodyHtml.append(getMsg("msg.enter.string", locale));
}
bodyHtml.append("<br><br>");
bodyHtml.append(getInfoMsg("msg.note.mojibake", locale));
bodyHtml.append("</form>");
responseToClient(req, res, getMsg("title.mojibake.page", locale), bodyHtml.toString());
} catch (Exception e) {
log.error("Exception occurs: ", e);
}
}