java - Add space between string to display in HTML file -


i doing assignment create html java code. knows how add space between words? example, when type

java fun

then create html display word without space

javafun

i did try add space textrow.append("<td>" + words.get(i).getword().replaceall("", " ") + "</td>"); didn't work

this code:

private void addwordlist(arraylist<wordtracker> words) {     // holds 1 line of table text @ time.     out.write("<table align='center' >");     stringbuilder textrow = new stringbuilder();     int rowcounter = 0;     (int = 0; < words.size(); i++) {         if (rowcounter == 0) {             textrow.append("<tr class='answerkey'>");         }         textrow.append("<td>" + words.get(i).getword() + "</td>");         rowcounter++;         if (rowcounter == 5 || == words.size() - 1) {             rowcounter = 0;             textrow.append("</tr>");         }     }     out.write(textrow.tostring());     // add closing remarks     out.write("</table>");     out.write("</br>"); }  public class wordtracker{     private string word;     private int size;     private coordinate begincoordinate;     private coordinate endcoordinate;       public wordtracker(string word_in, int size_in, coordinate begincoord_in, coordinate endcoord_in) {         size = size_in;         word = word_in;         begincoordinate = begincoord_in;         endcoordinate = endcoord_in;     }      public string getword(){         return word;     }      public int getsize(){         return size;     }      public coordinate getbegincoordinate(){         return begincoordinate;     }      public coordinate getendcoordinate(){         return endcoordinate;     }      public void setword(string word_in) {         word = word_in;     }      public void setsize(int size_in) {         size = size_in;     }      public void setbegincoordinate(coordinate begincoordinate_in) {         begincoordinate = begincoordinate_in;     }      public void setendcoordinate(coordinate endcoordinate_in) {         endcoordinate = endcoordinate_in;     }      /**      * returns string representation of placedwordtracker.      * prints word, number , coordinates.     */     @override     public string tostring() {         return word + ", size:" + size + ", begin:" + begincoordinate + ", end:" + endcoordinate + "\n";     } } 

any great! thank you!


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -