Here you can find the source of createHTMLList(String list, String link, boolean APPEND, String title)
Parameter | Description |
---|---|
list | the line separated list of items |
link | the URL base |
APPEND | true if list items should be appended to the end of link |
title | the title of the generated HTML page (can be null) |
public static String createHTMLList(String list, String link, boolean APPEND, String title)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**//from w w w . ja v a 2 s .c om * Convert a line separated list into an HTML list of links. * @param list the line separated list of items * @param link the URL base * @param APPEND true if list items should be appended to the end of link * @param title the title of the generated HTML page (can be null) * @return an HTML version of the given list */ public static String createHTMLList(String list, String link, boolean APPEND, String title) { String buffer = ""; Scanner scanner = new Scanner(list); String line, endpoint; int tmpi; if (title != null) { buffer += "<h1>" + title + "</h1>\n"; } buffer += "<ul>\n"; while (scanner.hasNextLine()) { line = scanner.nextLine().trim(); endpoint = line; tmpi = endpoint.indexOf('('); if (tmpi >= 0) { //Remove full application name within parenthesis of software list endpoint = endpoint.substring(0, tmpi).trim(); } buffer += "<li><a href=\"" + link; if (APPEND) buffer += endpoint; buffer += "\">" + line + "</a></li>\n"; } buffer += "</ul>\n"; scanner.close(); // added by Edgar Black return buffer; } }