Java HTML Create boldIf(String str, boolean bold)

Here you can find the source of boldIf(String str, boolean bold)

Description

Makes a string bold if condition bold is true.

License

Open Source License

Parameter

Parameter Description

Return

str or str

Declaration

public static String boldIf(String str, boolean bold) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  ww  w.  j  av  a2  s.  c  om*/
     * Makes a string bold if condition bold is true.
     * Uses html to make the changes.
     * Do not forget to add <html></html> into your string!
     *
     * @param str:  string to make bold (eventually)
     * @param bold: surrounds string with <b> on true
     * @return str or <b>str</b>
     */
    public static String boldIf(String str, boolean bold) {
        if (bold) {
            return bold(str);
        } else {
            return str;
        }
    }

    /**
     * Make String bold.
     *
     * @param str
     * @return
     */
    public static String bold(String str) {
        return "<b>" + str + "</b>";
    }
}

Related

  1. bold(String str)
  2. bold(String text)
  3. bold(String text)
  4. boldenRefOrType(String label)
  5. boldHTML(String input)
  6. italics(String inner)