当前位置: 首页>>代码示例>>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;未经允许,请勿转载。