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


Java WordUtils類代碼示例

本文整理匯總了Java中org.apache.commons.lang.WordUtils的典型用法代碼示例。如果您正苦於以下問題:Java WordUtils類的具體用法?Java WordUtils怎麽用?Java WordUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WordUtils類屬於org.apache.commons.lang包,在下文中一共展示了WordUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRow

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
/**
 * Return the ith row of the column as a set of wrapped strings, each at
 * most wrapWidth in length.
 */
String[] getRow(int idx) {
  String raw = rows.get(idx);
  // Line-wrap if it's too long
  String[] lines = new String[] {raw};
  if (wrap) {
    lines = WordUtils.wrap(lines[0], wrapWidth, "\n", true).split("\n");
  }
  for (int i=0; i<lines.length; i++) {
    if (justification == Justification.LEFT) {
      lines[i] = StringUtils.rightPad(lines[i], maxWidth);
    } else if (justification == Justification.RIGHT) {
      lines[i] = StringUtils.leftPad(lines[i], maxWidth);
    }
  }
  return lines;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:21,代碼來源:TableListing.java

示例2: fillContent

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
private void fillContent(String owner, String edition, String expires, String additionalInformation) {
    if(owner != null) {
        this.lbRegisteredToResult.setText(owner);
    } else {
        this.lbRegisteredToResult.setText("-");
    }

    if(edition != null) {
        this.lbStatus.setText(WordUtils.capitalize(edition) + " " + LICENSE_INSTALLED);
    } else {
        this.lbStatus.setText("- " + LICENSE_INSTALLED);
    }

    if(expires != null) {
        this.lbExpiresResult.setText(expires);
    } else {
        this.lbExpiresResult.setText("-");
    }

    if(additionalInformation != null && additionalInformation.trim().isEmpty()) {
        this.lbAdditionalInfo.setText((String)null);
    } else {
        this.lbAdditionalInfo.setText(additionalInformation);
    }

}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:27,代碼來源:ActivationSuccessfulCard.java

示例3: onMatchEnd

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOW)
public void onMatchEnd(MatchEndEvent event) {
    Match match = event.getMatch();
    Tourney plugin = Tourney.get();
    this.session.appendMatch(match, plugin.getMatchManager().getTeamManager().teamToEntrant(Iterables.getOnlyElement(event.getMatch().needMatchModule(VictoryMatchModule.class).winners(), null)));

    Entrant winningParticipation = this.session.calculateWinner();
    int matchesPlayed = this.session.getMatchesPlayed();
    if (winningParticipation != null) {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has been determined!");
        Bukkit.broadcastMessage(ChatColor.AQUA + WordUtils.capitalize(winningParticipation.team().name()) + ChatColor.RESET + ChatColor.YELLOW + " wins! Congratulations!");
        plugin.clearKDMSession();
    } else if (matchesPlayed < 3) {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has not yet been determined! Beginning match #" + (matchesPlayed + 1) + "...");
        match.needMatchModule(CycleMatchModule.class).startCountdown(Duration.ofSeconds(15), session.getMap());
    } else {
        Bukkit.broadcastMessage(ChatColor.YELLOW + "There is a tie! Congratulations to both teams!");
        Tourney.get().clearKDMSession();
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:21,代碼來源:KDMListener.java

示例4: 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

示例5: build

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
@PostConstruct
public void build() {
    log.info("--- E-mail config ---");

    if (StringUtils.isBlank(getGenerator())) {
        throw new ConfigurationException("generator");
    }

    if (StringUtils.isBlank(getConnector())) {
        throw new ConfigurationException("connector");
    }

    log.info("From: {}", identity.getFrom());

    if (StringUtils.isBlank(identity.getName())) {
        identity.setName(WordUtils.capitalize(mxCfg.getDomain()) + " Identity Server");
    }
    log.info("Name: {}", identity.getName());
    log.info("Generator: {}", getGenerator());
    log.info("Connector: {}", getConnector());
}
 
開發者ID:kamax-io,項目名稱:mxisd,代碼行數:22,代碼來源:EmailConfig.java

示例6: getLongUsage

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
@Override
public String getLongUsage() {
  TableListing listing = AdminHelper.getOptionDescriptionListing();

  listing.addRow("<name>", "Name of the pool to modify.");
  listing.addRow("<owner>", "Username of the owner of the pool");
  listing.addRow("<group>", "Groupname of the group of the pool.");
  listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
  listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
      "by this pool.");
  listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
      "directives being added to the pool.");

  return getShortUsage() + "\n" +
      WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
      "See usage of " + AddCachePoolCommand.NAME + " for more details.",
      AdminHelper.MAX_LINE_WIDTH) + "\n\n" +
      listing.toString();
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:CacheAdmin.java

示例7: onPlayerChat

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOW)
public void onPlayerChat(AsyncPlayerChatEvent e) {
    PAUser u = PAServer.getUser(e.getPlayer());

    //AdminChat
    if (PAServer.getAdminChatMode().contains(u)) {
        Utils.sendAdminMsg(u.getName(), e.getMessage());
        e.setCancelled(true);
    }

    //Format
    String name = u.getDisplayName().equalsIgnoreCase("") ? u.getName() : u.getDisplayName();
    String tag = "[&" + PACmd.Grupo.groupColor(u.getUserData().getGrupo()) + WordUtils.capitalizeFully(u.getUserData().getGrupo().toString().toLowerCase()) + "&r] &" + PACmd.Grupo.groupColor(u.getUserData().getGrupo()) + name + "&r: ";
    if (u.isOnRank(PACmd.Grupo.ORIGIN)) e.setMessage(Utils.colorize(e.getMessage()));

    e.setFormat(Utils.colorize(tag) + e.getMessage().replace("%", ""));
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:18,代碼來源:PlayerListener.java

示例8: setupRankUpMenu

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
public static void setupRankUpMenu(Player player) {
	Inventory inv = Bukkit.createInventory(player, 9, ChatColor.BOLD + "Rank-Up");
	int challenge = plugin.getPlayerManager().getRank(player) + 1;
	inv.setItem(2, ItemStackGenerator.createItem(Material.DIAMOND_HELMET, 0, 0, 
			ChatColor.LIGHT_PURPLE + "I trust my strength!",
			Arrays.asList(	ChatColor.RED 	+ "Earn rankup by completing the challenge",
							ChatColor.RED 	+ "for lesser amount of money!"), true));
	inv.setItem(4, ItemStackGenerator.createItem(Material.BOOK, 0, 0, 
			ChatColor.LIGHT_PURPLE + "RankUp Information",
			Arrays.asList(	ChatColor.RED + "Next rank: " + plugin.getChallengesFile().getTitle(challenge),
							ChatColor.RED + "Challenge type: " + WordUtils.capitalize(plugin.getChallengesFile().getType(challenge)),
							ChatColor.RED + "Price: " + Convert.toPrice(plugin.getChallengesFile().getPrice(challenge) * (plugin.getPlayerManager().getPrestige(player) + 1), true))));
	inv.setItem(6, ItemStackGenerator.createItem(Material.GOLD_INGOT, 0, 0, 
			ChatColor.LIGHT_PURPLE + "I can buy anything!",
			Arrays.asList(	ChatColor.RED 	+ "Skip the challenge by",
							ChatColor.RED + "paying 2 times more!")));
	player.openInventory(inv);
}
 
開發者ID:benNek,項目名稱:AsgardAscension,代碼行數:19,代碼來源:MainInventory.java

示例9: 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

示例10: addQueryWord

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
private void addQueryWord(String s){
    if(s==null)return;
    if(s.length()==0)return;
    if(queryWords.contains(s))
        return;
    else
        queryWords.add(s);
    
    if(sb.length()>0) sb.append(" OR ");
    sb.append(s+"[obj] OR "+ s + "[subj]");
    List<String> ls = new LinkedList<String>();
    ls.add(s.toUpperCase());
    ls.add(s.toLowerCase());
    ls.add(WordUtils.capitalize(s));
    for(String x:ls){
        sb.append(" OR ");
        sb.append(x);
        sb.append("[obj] OR ");
        sb.append(x);
        sb.append("[subj]");
    }
}
 
開發者ID:oaqa,項目名稱:bioasq,代碼行數:23,代碼來源:GoPubMedTripleRetrievalExecutor.java

示例11: handleGroup

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
private void handleGroup(YamlConfiguration config, String line) {
    String[] lineContents = line.replace("=", "").split(" ");
    String[] permissionSplit = lineContents[0].split("\\.");
    String group = WordUtils.capitalizeFully(permissionSplit[permissionSplit.length - 1]);
    String permission = lineContents[0];
    String type = lineContents[1];
    String value = line.substring(line.indexOf("\"") + 1);
    value = value.substring(0, value.indexOf("\""));
    config.set("Groups." + group + ".Permission", permission);
    config.set("Groups." + group + ".SortPriority", -1);
    if (type.equals("prefix")) {
        config.set("Groups." + group + ".Prefix", value);
    } else {
        config.set("Groups." + group + ".Suffix", value);
    }
}
 
開發者ID:sgtcaze,項目名稱:NametagEdit,代碼行數:17,代碼來源:Converter.java

示例12: getBean

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
/**
 * Attempts to find a Spring bean based of the specified class. This method first attempts to load a bean
 * following the default Spring auto-naming conventions (de-capitalizing class simple name). In case the bean with 
 * this name can't be found, the method returns the first available bean of this class.
 * <p/>
 * Such logic is required in order to enable this method to lookup components from legacy contexts. "Older" beans seems to 
 * have identifiers hard-coded in the bean definition file, while "newer" bean identifiers are auto-generated by Spring based on the
 * annotations.
 * 
 * @param clazz
 * 		Class of the bean to be looked up
 * @return
 * 		Returns the bean instance
 * @throws NoSuchBeanDefinitionException if there is no bean definition with the specified name
 */
@SuppressWarnings("unchecked")
public static <T> T getBean(Class<?> clazz) {
	// legacy code - I wonder if it's necessary since we are looking up a bean based directly on the class name anyways
	// but to keep legacy logic working properly attempt to locate component based on the Spring conventions 
	String className = WordUtils.uncapitalize(clazz.getSimpleName());
	if (beanFactory.containsBean(className))
		return (T) beanFactory.getBean(className);
	
	if (ListableBeanFactory.class.isAssignableFrom(beanFactory.getClass())) {
		ListableBeanFactory listableBeanFactory = (ListableBeanFactory) beanFactory;
		String[] beanNames = listableBeanFactory.getBeanNamesForType(clazz);
		if (beanNames.length > 0)
			return (T) listableBeanFactory.getBean(beanNames[0]);
	}
	throw new NoSuchBeanDefinitionException(clazz);
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:32,代碼來源:SpringUtils.java

示例13: execute

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
@Override
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<LabelValueBean> results = new ArrayList<LabelValueBean>();
String codingSystem = request.getParameter("codingSystem");

AbstractCodeSystemDao dao = (AbstractCodeSystemDao)SpringUtils.getBean(WordUtils.uncapitalize(codingSystem) + "Dao");

if(request.getParameter("term") != null && request.getParameter("term").length() > 0) {
	List<AbstractCodeSystemModel> r = dao.searchCode(request.getParameter("term"));
	for(AbstractCodeSystemModel result:r) {
		results.add(new LabelValueBean(result.getDescription(),result.getCode()));
	}
}
response.setContentType("text/x-json");
      JSONArray jsonArray = JSONArray.fromObject( results );
      jsonArray.write(response.getWriter());

   return null;
  }
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:20,代碼來源:CodeSearchService.java

示例14: abbreviate

import org.apache.commons.lang.WordUtils; //導入依賴的package包/類
/**
 * convert "From src insert blah blah" to "From src insert ... blah"
 */
public static String abbreviate(String str, int max) {
  str = str.trim();

  int len = str.length();
  int suffixlength = 20;

  if (len <= max) {
    return str;
  }

  suffixlength = Math.min(suffixlength, (max - 3) / 2);
  String rev = StringUtils.reverse(str);

  // get the last few words
  String suffix = WordUtils.abbreviate(rev, 0, suffixlength, "");
  suffix = StringUtils.reverse(suffix);

  // first few ..
  String prefix = StringUtils.abbreviate(str, max - suffix.length());

  return prefix + suffix;
}
 
開發者ID:mini666,項目名稱:hive-phoenix-handler,代碼行數:26,代碼來源:Utilities.java

示例15: 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


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