TOUGH PROBLEM
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> Apr 28, 2000
- 370 views
------=_NextPart_000_0012_01BFB14F.15E19020 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable could you add code to this function, so that it will return {formated text=20 (s, what is returned now), sequnce with with positions where CHARACTERS and NUBERS are,=20 i need them so can display text colored (red for numbers, YELLOW for strings) i just can't do it! it is complicated function print_format2( object o ) -- returns object formatted for wPrint sequence s if atom( o ) then -- number if o >=3D ' ' and o <=3D '}' then --return CHARACTER return sprintf( "'%s'", o ) else --return NUMBER return sprintf( "%d", o ) end if else -- list s =3D "{" for i =3D 1 to length( o ) do s =3D s & print_format2( o[i] ) if i < length( o ) then s =3D s & "," end if end for s =3D s & "}" return s end if end function ------=_NextPart_000_0012_01BFB14F.15E19020 charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-2" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3D"Lucida Casual" size=3D2>could you add code to this=20 function,</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>so that it will return = {formated text=20 </FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>(s, what is returned=20 now),</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>sequnce with with positions=20 where</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>CHARACTERS and NUBERS are, = </FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>i need them so can display = text colored=20 (red for</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>numbers, YELLOW for = strings)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>i just can't do it! it is=20 complicated</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2></FONT> </DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>function print_format2( = object o=20 )</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2> -- returns = object=20 formatted for wPrint<BR> sequence s</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2> if atom( o = )=20 then<BR> -- = number<BR> if o=20 >=3D ' ' and o <=3D '}' then</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2> --return=20 CHARACTER<BR> return sprintf( "'%s'", o=20 )<BR> else</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2> --return=20 NUMBER</FONT></DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2> return = sprintf( "%d", o=20 )<BR> end if<BR> =20 else<BR> --=20 list<BR> s =3D=20 "{"<BR> for i =3D 1 to length( = o )=20 do<BR> = s =3D s=20 & print_format2( o[i]=20 )<BR> = if i=20 < length( o )=20 ; =20 s =3D s &=20 end=20 if<BR> end=20 for<BR> s =3D s &=20 "}"<BR> return = s<BR> =20 end if</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Lucida Casual" size=3D2>end=20 ------=_NextPart_000_0012_01BFB14F.15E19020--