wrap_string

Insert HTML
tags at set intervals in a string to force wrapping by a browser.

Available in:
TRIMapp TRIMrep GUIapp GUIrep Standalone PL
X X X X X

Syntax

string wrap_string(text,interval)
string    text
int       interval

Description

In some browsers, long strings are displayed on single lines without wrapping and these strings distort HTML documents. Wrap_string() was created to fit long SMILES strings into cells of an HTML table by forcing them to wrap at set intervals.

Example

The following code writes an HTML table using values from a GUI window list. Wrap_string() is used to wrap the chemical name at the 73rd character and to segment the SMILES string into 92 character sections.
...
list_mod(html_list,1,"<BR><TABLE BORDER=0 WIDTH= 600"
                     " CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER> ");
list_mod(html_list,1,"<TR> ");
list_mod(html_list,1,"<TD WIDTH= 57><FONT SIZE=-1><B>Base:</B></TD>");
list_mod(html_list,1,"<TD WIDTH=543><FONT SIZE=-1><B>"
                     ^^wrap_string(list_curr(bottle.wl,@bottle.chemname),73)
                     ^^"</B></TD>");
list_mod(html_list,1,"</TR> ");
list_mod(html_list,1,"<TR> ");
list_mod(html_list,1,"<TD> <FONT SIZE=-1><B>Salt:</B></TD>");
list_mod(html_list,1,"<TD> <FONT SIZE=-1><B>"
                     ^^list_curr(bottle.wl,@bottle.salt)^^"</B></TD>");
list_mod(html_list,1,"</TR> ");
list_mod(html_list,1,"<TR> ");
list_mod(html_list,1,"<TD> <FONT SIZE=-1><B>SMILES:</B></TD>");


list_mod(html_list,1,"<TD> <FONT FACE='Courier New' SIZE=1>"
                 ^^wrap_string(list_curr(accession.wl,@accession.smi_access),92)
                     ^^"</FONT></TD>");
list_mod(html_list,1,"</TR>");
list_mod(html_list,1,"</TABLE>")
...