Helma logo
helma.org » Home > Stories > format()

format()

Prepares a string for smooth HTML output.

Similar to encode() this function substitutes special characters in a string with their equivalent HTML entities and adds HTML line breaks, but keeps existing markup tags as is and also tries to avoid <br /> tags where ever possible (e.g. in table structures).

Syntax
format(String)

Example
var str = format("<b>Bananer växer\n minsann inte på träd.</b>");
res.write(str);
<b>Bananer v&auml;xer
<br /> minsann inte p&aring; tr&auml;d.</b>


... comment


Page last modified on 2002-07-10 08:30 by hns