[Zope] string n times

Tino Wildenhain tino@wildenhain.de
Tue, 25 Apr 2000 16:57:02 +0200


Hi Jim,

Jim Sanford wrote:
> 
> If score is equal to 8 then <dtml-var "'*' * score"> will give you ********
> 
> ----- Original Message -----
> From: Jorge Magalhaes <root@predict.telepac.pt>
> To: <zope@zope.org>
> Sent: Tuesday, April 25, 2000 8:47 AM
> Subject: [Zope] string n times
> 
> Hi:
> 
> How i can repeat a string n times.  For example in  perl i can do:
(Yeah, again, where is the dammed questionmark? ;-)

> 
>             "*" x $score  ($score is a integer)
(shown already)

> For example:
> 
> Student_ID Score
> ------------------------------------------
> 1030 *****************
> 1031 *******************
> 1032 ************
> 1033 ************************
> __________________________________________
> Mean ****************
> -------------------------------------------
Easy as hell:

<dtml-in database_query_over_students_score>
    <dtml-if sequence-start>
        <table border=0>
        <tr>
        <td>Student_ID</td><td>Score</td>
        </tr>
        <tr>
        <td colspan="2"><hr></td>
        </tr>
    </dtml-if>
    <tr>
    <td><dtml-var Student_ID></td>
    <td><dtml-var "'*' * Score"></td>
    </tr>
    <dtml-if sequence-end>
        <tr>
        <td colspan="2"><hr></td>
        </tr>
        <tr>
        <td>Mean</td>
        <td><dtml-var "'*' * _.int(_['mean-Score'])"></td>
        </tr>
        <tr>
        <td colspan="2"><hr></td>
        </tr>
        </table>
</dtml-in>
</dtml-if>
<dtml-var