当前位置: 首页>>代码示例>>Java>>正文


Java Strings.padEnd方法代码示例

本文整理汇总了Java中com.google.common.base.Strings.padEnd方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.padEnd方法的具体用法?Java Strings.padEnd怎么用?Java Strings.padEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.base.Strings的用法示例。


在下文中一共展示了Strings.padEnd方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createWordsPermutation

import com.google.common.base.Strings; //导入方法依赖的package包/类
private LinkedList<String> createWordsPermutation(List<String> words, int i, Ending ending) {
    LinkedList<String> currPermutation = Lists.newLinkedList(words);
    for (int k = 0; k < i; k++) {
        if (ending == Ending.HEAD || ending == Ending.BOTH) {
            String currHeadPwd = Strings.padEnd(HEAD_ELEMENT, i - k, HEAD_ELEMENT.charAt(0));
            currPermutation.push(currHeadPwd);
        }
        if (ending == Ending.TAIL || ending == Ending.BOTH) {
            String currTailPwd = Strings.padEnd(TAIL_ELEMENT, k, TAIL_ELEMENT.charAt(0));
            currPermutation.add(currTailPwd);
        }
    }
    return currPermutation;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:15,代码来源:WordsPermutationUtil.java

示例2: testNicknameUI

import com.google.common.base.Strings; //导入方法依赖的package包/类
@Test
public void testNicknameUI() {
	Assert.assertNotNull(setupActivity);
	String longNick =
			Strings.padEnd("*", AuthorConstants.MAX_AUTHOR_NAME_LENGTH + 1,
					'*');
	nicknameEntry.setText(longNick);
	// Nickname should be too long
	assertEquals(nicknameEntryWrapper.getError(),
			setupActivity.getString(R.string.name_too_long));
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:12,代码来源:SetupActivityTest.java

示例3: attributeLabel

import com.google.common.base.Strings; //导入方法依赖的package包/类
private String attributeLabel(String label) {
    return Strings.padEnd(label, LABEL_LENGTH, ' ');
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:ModelNodeRenderer.java

示例4: toString

import com.google.common.base.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
    return ucteCountryCode.getUcteCode() + Strings.padEnd(geographicalSpot, 5, ' ') + voltageLevelCode.ordinal() + (busbar != null ? busbar : ' ');
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:5,代码来源:UcteNodeCode.java

示例5: sendModuleSummary

import com.google.common.base.Strings; //导入方法依赖的package包/类
/**
 * Sends a module summary (similar to the Maven Reactor Summary)
 */
public void sendModuleSummary() {
    if(logger == null) return;
    List<String> summaryMessages = new ArrayList<>();

    summaryMessages.add(Strings.repeat("-", 75));
    summaryMessages.add("Module Summary: ");
    summaryMessages.add(" ");

    // for averages
    double successCount = 0;
    double totalTime = 0;

    for(Module m : getModules()) {
        String name = Strings.padEnd(m.getName() + " ", 25, '.');
        String state = (m.isEnabled() ? ConsoleColor.GREEN + "SUCCESS" : ConsoleColor.RED + "FAILURE") + ConsoleColor.RESET;
        double time = (double) m.getEnableTime() / 1000;

        // averages
        if(m.isEnabled()) successCount++;
        totalTime += time;

        String timeString = "[ " + Strings.padStart(StringUtil.applyDecimalLength(time, 3), 6, ' ') + " s]";
        String error = m.isEnabled() ? "" : " (" + (m.getErrorReason() != null ? m.getErrorReason().getClass().getSimpleName() : "Not Enabled") + ")";
        summaryMessages.add(name + " " + state + " " + timeString + error);
    }
    summaryMessages.add(" ");

    String totalTimeString = NumberUtil.round(totalTime, 4);
    summaryMessages.add("Total time: " + totalTimeString + "s");

    // success
    double successRate = successCount / getModules().size() * 100;
    String successRateString = (successRate <= 25 ? ConsoleColor.DARK_RED
            : successRate <= 50 ? ConsoleColor.RED
            : successRate <= 75 ? ConsoleColor.GOLD
            : successRate <= 99 ? ConsoleColor.YELLOW
            : ConsoleColor.GREEN
    ) + NumberUtil.round(successRate, 4) + "%" + ConsoleColor.RESET;

    // time and footer
    String averageTimeString = NumberUtil.round(totalTime / getModules().size(), 4);
    summaryMessages.add("Success rate: " + successRateString + " | Average time: " + averageTimeString + "s");
    summaryMessages.add(Strings.repeat("-", 75));

    // send all messages
    summaryMessages.forEach(s -> logger.info(s));
}
 
开发者ID:Superioz,项目名称:MooProject,代码行数:51,代码来源:ModuleRegistry.java

示例6: paddedLevelName

import com.google.common.base.Strings; //导入方法依赖的package包/类
private static String paddedLevelName(Level level) {
    return Logging.levelColor(level) + Strings.padEnd(levelName(level), 6, ' ') + ChatColor.RESET;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:LoggingCommands.java


注:本文中的com.google.common.base.Strings.padEnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。