當前位置: 首頁>>代碼示例>>Java>>正文


Java WordUtils.capitalize方法代碼示例

本文整理匯總了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;
}
 
開發者ID:magento,項目名稱:magento2-phpstorm-plugin,代碼行數:21,代碼來源:PluginLineMarkerProvider.java

示例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));
}
 
開發者ID:IsaacChanghau,項目名稱:Word2VecfJava,代碼行數:17,代碼來源:ContextInstance.java

示例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());
}
 
開發者ID:ctripcorp,項目名稱:dal,代碼行數:17,代碼來源:AbstractJavaDataPreparer.java

示例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());
}
 
開發者ID:ctripcorp,項目名稱:dal,代碼行數:17,代碼來源:AbstractCSharpDataPreparer.java

示例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;
}
 
開發者ID:openmrs,項目名稱:openmrs-module-legacyui,代碼行數:26,代碼來源:FormatTag.java

示例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;
	
}
 
開發者ID:ltrr-arizona-edu,項目名稱:tellervo,代碼行數:23,代碼來源:RediscoveryExportEx.java

示例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;
}
 
開發者ID:motech,項目名稱:motech,代碼行數:25,代碼來源:KeyEvaluator.java

示例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;
	}
}
 
開發者ID:MadMarty,項目名稱:madsonic-server-5.1,代碼行數:21,代碼來源:JaudiotaggerParser.java

示例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 + "=========================");
}
 
開發者ID:cancabron,項目名稱:Annihilation,代碼行數:20,代碼來源:StatsCommand.java

示例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;
}
 
開發者ID:cancabron,項目名稱:Annihilation,代碼行數:17,代碼來源:Shop.java

示例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));
}
 
開發者ID:FenixEdu,項目名稱:fenixedu-academic,代碼行數:20,代碼來源:Diploma.java

示例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));

}
 
開發者ID:FenixEdu,項目名稱:fenixedu-academic,代碼行數:20,代碼來源:PhdDiploma.java

示例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,}", " " ) );
}
 
開發者ID:jkgohlke,項目名稱:flatfile,代碼行數:21,代碼來源:AddressProcessor.java

示例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;
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:11,代碼來源:FrmXml2VTData.java

示例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);
    }
}
 
開發者ID:k-tamura,項目名稱:easybuggy,代碼行數:38,代碼來源:MojibakeServlet.java


注:本文中的org.apache.commons.lang.WordUtils.capitalize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。