CODECUBE VENTURES

Plain Text Formatter

Utility that takes some plain text, and transforms linebreaks to html breaks


<script language="javascript">

function ptf_format() {

var pre = document.ptf.pre;

var post = document.ptf.post;

var pretext = pre.value;

pretext = pretext.split("\n");

pretext = pretext.join("<br>");

//pretext = pretext.split(" ");

//pretext = pretext.join(" ");

post.value = pretext;

}

</script>

Notice the two lines that are commented out, these are there in case you also want to transform spaces into HTML non breaking spaces (thus preserving whitespace formatting also)

Latest post: Chimpiler - From Morning Idea to Shipped .NET Tool by Evening

See more in the archives