Actually that last one should be:StringTokenizer tok = new StringTokenizer(str, "\n");while(tok.hasMoreTokens())buf.append(tok.nextToken().append)"<BR>");