Java String Indent Format indentHtmlSpaces(int count)

Here you can find the source of indentHtmlSpaces(int count)

Description

Indent with HTML no break spaces.

License

Open Source License

Parameter

Parameter Description
count The number of spaces.

Return

String with spaces.

Declaration

public static String indentHtmlSpaces(int count) 

Method Source Code

//package com.java2s;
/**/*from   w  w w  .j a  va2 s  .com*/
 * TestTheTeacher.
 * Test the teacher to see whether he or she is really good enough at basing programming.
 * A project for a school of applied sciences.
 *
 * @author MingYan Li, Tim Visee
 * @copyright Copyright (c) MingYan Li & Tim Visee 2015. All rights reserved.
 * @license GNU GPL v3.0
 */

public class Main {
    /**
     * Indent with HTML no break spaces.
     *
     * @param count The number of spaces.
     *
     * @return String with spaces.
     */
    public static String indentHtmlSpaces(int count) {
        // Create a string builder for the spaces
        StringBuilder builder = new StringBuilder();

        // Add the spaces
        for (int i = 0; i < count; i++)
            builder.append("&nbsp;");

        // Return the result
        return builder.toString();
    }
}

Related

  1. indentation(int numberOfIndent)
  2. indentationLevel(CharSequence c)
  3. indentationStringOfCursorLine(String text, int cursor)
  4. indentCode(String code, int indentLevel)
  5. indented(String indenter, String s)
  6. indention(int level, int tabSize)
  7. indentLinesAfterNth(final int skip, final int indent, final String str)
  8. indentMultilineValue(String value, StringBuilder tableInfo, int[] columnWidths, boolean printNull)
  9. indentNextLines(String text, String indent)