OSCore (Open Symphony Core) is a java library with lot of utilities and reusable components. This requires the libraries oscore-2.2.6.jar, mail.jar to be in classpath. The following example shows using TextUtils.wrapParagraph() API.
package com.bethecoder.tutorials.oscore; import com.opensymphony.util.TextUtils; public class WrapParagraphTest { /** * @param args */ public static void main(String[] args) { String html = TextUtils.wrapParagraph("ONE\n TWO \n\n THREE\n FOUR"); System.out.println(html); } }
<p>ONE TWO </p> <p> THREE FOUR</p>