當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。